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 ca9e2af
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/lisp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up NASM
uses: ilammy/setup-nasm@v1

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: [ "linux/amd64", "linux/386" ]

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.17'
platforms: "386"

- name: Test
run: ./test -DHEADLESS lisp/tester.asm
run: script -q -e -c "QEMU=qemu-system-i386 ./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 ca9e2af

Please sign in to comment.