Skip to content

Commit

Permalink
Test new cg2 branch of isolate with Ubuntu 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
wil93 committed Sep 14, 2024
1 parent f0d969b commit 619a895
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# syntax=docker/dockerfile:1
FROM ubuntu:20.04

RUN apt-get update
RUN apt-get install -y \
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
cgroup-lite \
cppreference-doc-en-html \
Expand All @@ -13,6 +12,7 @@ RUN apt-get install -y \
libcups2-dev \
libffi-dev \
libpq-dev \
libsystemd-dev \
libyaml-dev \
mono-mcs \
openjdk-8-jdk-headless \
Expand Down
2 changes: 1 addition & 1 deletion cms/grading/Sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ def build_box_options(self):
if self.box_id is not None:
res += ["--box-id=%d" % self.box_id]
if self.cgroup:
res += ["--cg", "--cg-timing"]
res += ["--cg"]
if self.chdir is not None:
res += ["--chdir=%s" % self.chdir]
for src, dest, options in self.dirs:
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ services:
volumes:
- "./codecov:/home/cmsuser/cms/codecov"
privileged: true
cgroup: host
command: >
wait-for-it testdb:5432 -- sh -c "
sudo mkdir /run/isolate ;
echo /sys/fs/cgroup | sudo tee /run/isolate/cgroup ;
isolate --print-cg-root ;
isolate-check-environment ;
isolate --cg --box-id 1 --init ;
ls /sys/fs/cgroup/box-1 ;
isolate --cg --box-id 1 --clean ;
dropdb --host=testdb --username=postgres cmsdbfortesting ;
createdb --host=testdb --username=postgres cmsdbfortesting ;
cmsInitDB ;
Expand Down
2 changes: 1 addition & 1 deletion isolate
22 changes: 18 additions & 4 deletions prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def build_isolate():
assert_not_root()

print("===== Compiling isolate")
# We make only the executable isolate, otherwise the tool a2x
# is needed and we have to add more compilation dependencies.
subprocess.check_call(["make", "-C", "isolate", "isolate"])
# We make only the executable isolate and isolate-cg-keeper, otherwise the
# tool a2x is needed and we have to add more compilation dependencies.
subprocess.check_call(["make", "--directory", "isolate", "isolate", "isolate-cg-keeper"])


def install_isolate():
Expand All @@ -214,7 +214,7 @@ def install_isolate():
exit(1)

# Check if build_isolate() has been called
if not os.path.exists(os.path.join("isolate", "isolate")):
if not os.path.exists(os.path.join("isolate", "isolate")) or not os.path.exists(os.path.join("isolate", "isolate-cg-keeper")):
print("[Error] You must run the build_isolate command first")
exit(1)

Expand All @@ -224,6 +224,18 @@ def install_isolate():
os.path.join(USR_ROOT, "bin", "isolate"),
root, 0o4750, group=cmsuser_grp)

print("===== Copying isolate-cg-keeper to /usr/local/bin/")
makedir(os.path.join(USR_ROOT, "bin"), root, 0o755)
copyfile(os.path.join(".", "isolate", "isolate-cg-keeper"),
os.path.join(USR_ROOT, "bin", "isolate-cg-keeper"),
root, 0o4750, group=cmsuser_grp)

print("===== Copying isolate-check-environment to /usr/local/bin/")
makedir(os.path.join(USR_ROOT, "bin"), root, 0o755)
copyfile(os.path.join(".", "isolate", "isolate-check-environment"),
os.path.join(USR_ROOT, "bin", "isolate-check-environment"),
root, 0o4750, group=cmsuser_grp)

print("===== Copying isolate config to /usr/local/etc/")
makedir(os.path.join(USR_ROOT, "etc"), root, 0o755)
copyfile(os.path.join(".", "isolate", "default.cf"),
Expand Down Expand Up @@ -374,6 +386,8 @@ def uninstall():

print("===== Deleting isolate from /usr/local/bin/")
try_delete(os.path.join(USR_ROOT, "bin", "isolate"))
try_delete(os.path.join(USR_ROOT, "bin", "isolate-cg-keeper"))
try_delete(os.path.join(USR_ROOT, "bin", "isolate-check-environment"))

print("===== Deleting configuration to /usr/local/etc/")
if ask("Type Y if you really want to remove configuration files: "):
Expand Down

0 comments on commit 619a895

Please sign in to comment.