Skip to content

Commit

Permalink
add post-install script for haskell
Browse files Browse the repository at this point in the history
  • Loading branch information
pretendWhale committed Apr 19, 2024
1 parent b61a55f commit 8a08e9f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/autotest_server/testers/haskell/haskell_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..tester import Tester, Test, TestError
from ..specs import TestSpecs

STACK_OPTIONS = ["--resolver=lts-14.27", "--system-ghc", "--allow-different-user"]
STACK_OPTIONS = ["--resolver=lts-16.17", "--system-ghc", "--allow-different-user"]


class HaskellTest(Test):
Expand Down
7 changes: 5 additions & 2 deletions server/autotest_server/testers/haskell/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def create_environment(_settings, _env_dir, default_env_dir):
resolver = "lts-14.27"
resolver = "lts-16.17"
cmd = ["stack", "build", "--resolver", resolver, "--system-ghc", *HASKELL_TEST_DEPS]
subprocess.run(cmd, check=True)

Expand All @@ -16,7 +16,10 @@ def create_environment(_settings, _env_dir, default_env_dir):

def install():
subprocess.run(os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.system"), check=True)

resolver = "lts-16.17"
cmd = ["stack", "build", "--resolver", resolver, "--system-ghc", *HASKELL_TEST_DEPS]
subprocess.run(cmd, check=True)
subprocess.run(os.path.join(os.path.dirname(os.path.realpath(__file__)), "stack_permissions.sh"), check=True, shell=True)

def settings():
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "settings_schema.json")) as f:
Expand Down
4 changes: 4 additions & 0 deletions server/autotest_server/testers/haskell/stack_permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "allow-different-user: true" >> $STACK_ROOT/config.yaml
chmod a+w $STACK_ROOT/stack.sqlite3.pantry-write-lock
chmod a+w $STACK_ROOT/global-project/.stack-work/stack.sqlite3.pantry-write-lock
chmod a+w $STACK_ROOT/pantry/pantry.sqlite3.pantry-write-lock
6 changes: 6 additions & 0 deletions server/autotest_server/tests/test_autotest_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ def test_sticky():
autotest_server._clear_working_directory(autotest_worker_working_dir, autotest_worker)

assert os.path.exists(path) is False

def test_stack_permissions():
stack_root = os.environ['STACK_ROOT']
path = f"{stack_root}/stack.sqlite3.pantry-write-lock"
permissions = oct(os.stat(path).st_mode)[-3:]
assert permissions[1] == '6'

0 comments on commit 8a08e9f

Please sign in to comment.