Skip to content

Commit

Permalink
Add aarch64 testing via CirrusCI (#4120)
Browse files Browse the repository at this point in the history
Fixes #4112
Towards #4054
* Use .cirrus.star file for handling CirrusCI jobs
* Add aarch64 entry for CirrusCI
* Don't run certain jobs expecting readonly or permission restricted files when running as root (Issue #4112)
  • Loading branch information
IAlibay authored Apr 12, 2023
1 parent 210e05c commit 87821bb
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 15 deletions.
18 changes: 18 additions & 0 deletions .cirrus.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://cirrus-ci.org/guide/programming-tasks/ for more information on
# starlark CirrusCI files
# Inspired by scipy's .cirrus.star script https://github.com/scipy/scipy/blob/main/.cirrus.star
# In the spirit of ensuring this can also be freely used in derviative works by
# the community, we release the contents of this file under the MIT license.


load("cirrus", "env", "fs")


def main(ctx):
# Default case: don't do anything if not in the core repo
# or if you're not targetting the develop branch
if ((env.get("CIRRUS_REPO_FULL_NAME") != "MDAnalysis/mdanalysis")
or (env.get("CIRRUS_BASE_BRANCH") != "develop")):
return []

return fs.read("maintainer/ci/cirrus-ci.yml")
15 changes: 0 additions & 15 deletions .cirrus.yml

This file was deleted.

31 changes: 31 additions & 0 deletions maintainer/ci/cirrus-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
linux_aarch64_task:
arm_container:
image: python:latest
cpu: 8
memory: 8G

ci_script: |
python3 --version
python3 -m venv mda-dev
source mda-dev/bin/activate
python3 -m pip install ./package
python3 -m pip install ./testsuite
python3 -m pip install pytest-xdist
python3 -m pytest -n 8 ./testsuite/MDAnalysisTests
macos_arm64_task:
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest

ci_script: |
brew update
brew install [email protected]
/opt/homebrew/bin/python3 -m venv ~/py_311
source ~/py_311/bin/activate
cd package
python -m pip install .
cd ../testsuite
python -m pip install .
python -m pip install pytest pytest-xdist
python -m pytest -n auto MDAnalysisTests
2 changes: 2 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The rules for this file:
* 2.5.0

Fixes
* Skip tests artificially checking for readonly or PermissionError cases
when running at root user on linux systems (Issue #4112, PR #4120)
* Fix chi1_selections() ignored atom names CG1 OG OG1 SG and incorrectly returned
None for amino acids CYS, ILE, SER, THR, VAL (Issue #4108)
* Fix parsing of box vector in H5MD reader (Issue #4076)
Expand Down
2 changes: 2 additions & 0 deletions testsuite/MDAnalysisTests/coordinates/test_xdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import MDAnalysis as mda
from MDAnalysis.coordinates.base import Timestep
from MDAnalysis.coordinates import XDR
from MDAnalysisTests.util import get_userid


class _XDRReader_Sub(object):
Expand Down Expand Up @@ -868,6 +869,7 @@ def test_unsupported_format(self, traj):
reader = self._reader(traj)
reader[idx_frame]

@pytest.mark.skipif(get_userid() == 0, reason="cannot readonly as root")
def test_persistent_offsets_readonly(self, tmpdir):
shutil.copy(self.filename, str(tmpdir))

Expand Down
3 changes: 3 additions & 0 deletions testsuite/MDAnalysisTests/core/test_universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
from MDAnalysisTests import assert_nowarns
from MDAnalysis.exceptions import NoDataError
from MDAnalysis.core.topologyattrs import AtomStringAttr
from MDAnalysisTests.util import get_userid


class IOErrorParser(TopologyReaderBase):
Expand Down Expand Up @@ -153,6 +154,8 @@ def test_Universe_invalidfile_IE_msg(self, tmpdir):
else:
raise AssertionError

@pytest.mark.skipif(get_userid() == 0,
reason="cannot permisssionerror as root")
def test_Universe_invalidpermissionfile_IE_msg(self, tmpdir):
# check for file with invalid permissions (eg. no read access)
with tmpdir.as_cwd():
Expand Down
11 changes: 11 additions & 0 deletions testsuite/MDAnalysisTests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,14 @@ def no_deprecated_call(func=None, *args, **kwargs):
__tracebackhide__ = True
with _NoDeprecatedCallContext():
return func(*args, **kwargs)


def get_userid():
"""
Calls os.geteuid() where possible, or returns 1000 (usually on windows).
"""
# no such thing as euid on Windows, assuming normal user 1000
if (os.name == 'nt' or not hasattr(os, "geteuid")):
return 1000
else:
return os.geteuid()

0 comments on commit 87821bb

Please sign in to comment.