Skip to content

Commit

Permalink
Fix build-and-test
Browse files Browse the repository at this point in the history
  • Loading branch information
rootmos committed Nov 1, 2022
1 parent 5bf06e8 commit af4c20a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
ARCH: ubuntu2204
UNPRIVILEGED: ubuntu
TEST_OUTPUT_DIR: /tmp/tests
WORKDIR: /tmp/workdir
steps:
- name: Install minimal dependencies
run: |
Expand All @@ -28,7 +29,7 @@ jobs:
echo "$UNPRIVILEGED ALL = NOPASSWD: $(which apt-get)" | tee -a /etc/sudoers
- name: Build package
run: sudo -u $UNPRIVILEGED env SUDO=sudo build/ubuntu/mk
run: sudo -u $UNPRIVILEGED --preserve-env=WORKDIR env SUDO=sudo build/ubuntu/mk

- name: Archive source package
uses: actions/upload-artifact@v3
Expand All @@ -42,9 +43,10 @@ jobs:

- name: Test system installation
run: |
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR env SUT=$(which hlua) tools/test-harness -c hlua
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR env SUT=$(which hpython) tools/test-harness -c hpython
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR env SUT=$(which hnode) tools/test-harness -c hnode
export TOOLS=$(readlink -f "$WORKDIR"/*/tools)
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS env SUT=$(which hlua) tools/test-harness -c hlua
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS env SUT=$(which hpython) tools/test-harness -c hpython
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS env SUT=$(which hnode) tools/test-harness -c hnode
- name: Archive test results
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -93,9 +95,10 @@ jobs:

- name: Test system installation
run: |
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR env SUT=$(which hlua) tools/test-harness -c hlua
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR env SUT=$(which hpython) tools/test-harness -c hpython
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR env SUT=$(which hnode) tools/test-harness -c hnode
export TOOLS=$(readlink -f build/archlinux/src/*/tools)
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS env SUT=$(which hlua) tools/test-harness -c hlua
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS env SUT=$(which hpython) tools/test-harness -c hpython
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS env SUT=$(which hnode) tools/test-harness -c hnode
- name: Archive test results
uses: actions/upload-artifact@v3
Expand Down
3 changes: 2 additions & 1 deletion build/archlinux/PKGBUILD.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ EOF
}

build() {
make tools build -C "$ROOT"
make tools -C "$ROOT"
make build -C "$ROOT"
}

check() {
Expand Down
9 changes: 7 additions & 2 deletions build/ubuntu/mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ OUTPUT_DIR=${OUTPUT_DIR-$SCRIPT_DIR/out}

HOST_TOOLS=${HOST_TOOLS-$(readlink -f "$SCRIPT_DIR/../../tools")}

WORKDIR=$(mktemp -d)
trap 'rm -rf $WORKDIR' EXIT
WORKDIR=${WORKDIR-}
if [ -z "$WORKDIR" ]; then
WORKDIR=$(mktemp -d)
trap 'rm -rf $WORKDIR' EXIT
else
mkdir -p "$WORKDIR"
fi

read SHA256 TARBALL < <("$HOST_TOOLS/archive" -O "$WORKDIR")
echo 1>&2 "- source tarball: $(basename "$TARBALL") $SHA256"
Expand Down
2 changes: 1 addition & 1 deletion tools/capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int main(int argc, char* argv[])

if(o.returncode_fn) {
debug("writing returncode to: %s", o.returncode_fn);
int fd = open(o.returncode_fn, O_WRONLY|O_EXCL|O_CREAT);
int fd = open(o.returncode_fn, O_WRONLY|O_EXCL|O_CREAT, 0644);
CHECK(fd, "open(%s)", o.returncode_fn);

char buf[48];
Expand Down

0 comments on commit af4c20a

Please sign in to comment.