Skip to content

Commit

Permalink
Fix the github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fsmv committed Aug 16, 2024
1 parent 815e2dd commit daff8d5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/lisp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: [ "linux/amd64", "linux/386" ]
platforms: "amd64,386"

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.17'
- name: Set up NASM
uses: ilammy/setup-nasm@v1

- name: Test
run: ./test -DHEADLESS lisp/tester.asm
run: script -q -e -c "QEMU=/usr/bin/qemu-x86_64 ./test -DHEADLESS lisp/tester.asm"
26 changes: 24 additions & 2 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ if [ "$#" -eq 0 ]; then
exit 1
fi

if [ -z "$QEMU" ]; then
QEMU="qemu-system-x86_64"
fi

file=${@: -1}
name="${file%%.*}"
binfile="bin/$name.bin"
Expand All @@ -14,9 +18,27 @@ if [ "$1" = "-DHEADLESS" ]; then
HEADLESS_ARGS="-display none"
fi

PID=$$
compile() {
nasm $file -f bin -o $binfile -DDEBUGCON ${@:2:$(($#-2))} && \
$QEMU $HEADLESS_ARGS -debugcon stdio -drive file=$binfile,format=raw,if=ide
ERR=$?
if [ $ERR -ne 0 ]; then
echo "Exit code: $ERR"
kill $PID
sleep 1
fi
return $ERR
}

mkdir -p `dirname $binfile`
OUTPUT=$(nasm $file -f bin -o $binfile -DDEBUGCON ${@:1:$(($#-1))} && \
qemu-system-x86_64 $HEADLESS_ARGS -debugcon stdio -drive file=$binfile,format=raw,if=ide | tee /dev/tty)
OUTPUT=$(compile ERROR $@ | tee /dev/tty)

exit $ERROR

if [ $ERROR -ne 0 ]; then
exit $ERROR
fi

if grep -q "FAIL" - <<< "$OUTPUT"; then
exit 1
Expand Down

0 comments on commit daff8d5

Please sign in to comment.