janet-lang / janet

A dynamic language and bytecode vm
https://janet-lang.org
MIT License
3.45k stars 223 forks source link

Added ARM32 CI test #1194

Closed zevv closed 1 year ago

zevv commented 1 year ago

Added arm32 cross compilation, run test with Qemu.

This test now fails, should succeed when #1193 gets merged.

sogaiu commented 1 year ago

Nice :+1:

I tried it out and got similar results.

$ make RUN="qemu-arm -L /usr/arm-linux-gnueabi/" test
for f in test/suite*.janet; do qemu-arm -L /usr/arm-linux-gnueabi/ ./build/janet "$f" || exit; done
Starting suite array...
Finished suite array in 0.016 seconds - 20 of 20 tests passed.
Starting suite asm...
Finished suite asm in 0.040 seconds - 5 of 5 tests passed.
Starting suite boot...
Finished suite boot in 0.362 seconds - 499 of 499 tests passed.
Starting suite buffer...
Finished suite buffer in 0.023 seconds - 35 of 35 tests passed.
Starting suite capi...
Finished suite capi in 0.007 seconds - 9 of 9 tests passed.
Starting suite cfuns...
Finished suite cfuns in 0.004 seconds - 2 of 2 tests passed.
Starting suite compile...
Finished suite compile in 0.009 seconds - 10 of 10 tests passed.
Starting suite corelib...
✘ test/suite-corelib.janet:32: "right shift unsigned 1": false
✘ test/suite-corelib.janet:33: "right shift unsigned 2": false
✘ test/suite-corelib.janet:35: "right shift unsigned non-immediate": false
✘ test/suite-corelib.janet:36: "right shift non-immediate": false
Finished suite corelib in 0.028 seconds - 58 of 62 tests passed.
make: *** [Makefile:247: test] Error 1

Noticed some warnings during compilation.

$ make RUN="qemu-arm -L /usr/arm-linux-gnueabi/" CC=arm-linux-gnueabi-gcc LD=arm-linux-gnueabit-gcc
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/abstract.boot.o -c src/core/abstract.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/array.boot.o -c src/core/array.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/asm.boot.o -c src/core/asm.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/buffer.boot.o -c src/core/buffer.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/bytecode.boot.o -c src/core/bytecode.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/capi.boot.o -c src/core/capi.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/cfuns.boot.o -c src/core/cfuns.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/compile.boot.o -c src/core/compile.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/corelib.boot.o -c src/core/corelib.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/debug.boot.o -c src/core/debug.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/emit.boot.o -c src/core/emit.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/ev.boot.o -c src/core/ev.c
src/core/ev.c: In function ‘janet_stream_unmarshal’:
src/core/ev.c:441:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  441 |     p->methods = (void *) janet_unmarshal_int64(ctx);
      |                  ^
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/ffi.boot.o -c src/core/ffi.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/fiber.boot.o -c src/core/fiber.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/gc.boot.o -c src/core/gc.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/inttypes.boot.o -c src/core/inttypes.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/io.boot.o -c src/core/io.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/marsh.boot.o -c src/core/marsh.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/math.boot.o -c src/core/math.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/net.boot.o -c src/core/net.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/os.boot.o -c src/core/os.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/parse.boot.o -c src/core/parse.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/peg.boot.o -c src/core/peg.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/pp.boot.o -c src/core/pp.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/regalloc.boot.o -c src/core/regalloc.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/run.boot.o -c src/core/run.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/specials.boot.o -c src/core/specials.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/state.boot.o -c src/core/state.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/string.boot.o -c src/core/string.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/strtod.boot.o -c src/core/strtod.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/struct.boot.o -c src/core/struct.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/symcache.boot.o -c src/core/symcache.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/table.boot.o -c src/core/table.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/tuple.boot.o -c src/core/tuple.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/util.boot.o -c src/core/util.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/value.boot.o -c src/core/value.c
src/core/value.c: In function ‘janet_lengthv’:
src/core/value.c:701:36: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  701 |                 if ((uint64_t) len <= (uint64_t) JANET_INTMAX_INT64) {
      |                                    ^~
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/vector.boot.o -c src/core/vector.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/vm.boot.o -c src/core/vm.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/wrap.boot.o -c src/core/wrap.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/array_test.boot.o -c src/boot/array_test.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/boot.boot.o -c src/boot/boot.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/buffer_test.boot.o -c src/boot/buffer_test.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/number_test.boot.o -c src/boot/number_test.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/system_test.boot.o -c src/boot/system_test.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/table_test.boot.o -c src/boot/table_test.c
arm-linux-gnueabi-gcc -DJANET_BOOTSTRAP -DJANET_BUILD="\"94722e56\"" -O0 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/janet_boot build/core/abstract.boot.o build/core/array.boot.o build/core/asm.boot.o build/core/buffer.boot.o build/core/bytecode.boot.o build/core/capi.boot.o build/core/cfuns.boot.o build/core/compile.boot.o build/core/corelib.boot.o build/core/debug.boot.o build/core/emit.boot.o build/core/ev.boot.o build/core/ffi.boot.o build/core/fiber.boot.o build/core/gc.boot.o build/core/inttypes.boot.o build/core/io.boot.o build/core/marsh.boot.o build/core/math.boot.o build/core/net.boot.o build/core/os.boot.o build/core/parse.boot.o build/core/peg.boot.o build/core/pp.boot.o build/core/regalloc.boot.o build/core/run.boot.o build/core/specials.boot.o build/core/state.boot.o build/core/string.boot.o build/core/strtod.boot.o build/core/struct.boot.o build/core/symcache.boot.o build/core/table.boot.o build/core/tuple.boot.o build/core/util.boot.o build/core/value.boot.o build/core/vector.boot.o build/core/vm.boot.o build/core/wrap.boot.o build/boot/array_test.boot.o build/boot/boot.boot.o build/boot/buffer_test.boot.o build/boot/number_test.boot.o build/boot/system_test.boot.o build/boot/table_test.boot.o -lm -lpthread -lrt -ldl
qemu-arm -L /usr/arm-linux-gnueabi/ build/janet_boot . JANET_PATH '/usr/local/lib/janet' > build/c/janet.c
cksum build/c/janet.c
3671596296 2846491 build/c/janet.c
arm-linux-gnueabi-gcc -O2 -g -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -c build/c/janet.c -o build/janet.o
src/core/ev.c: In function ‘janet_stream_unmarshal’:
src/core/ev.c:441:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  441 |     p->methods = (void *) janet_unmarshal_int64(ctx);
      |                  ^
src/core/value.c: In function ‘janet_lengthv’:
src/core/value.c:701:36: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  701 |                 if ((uint64_t) len <= (uint64_t) JANET_INTMAX_INT64) {
      |                                    ^~
cp src/mainclient/shell.c build/c/shell.c
arm-linux-gnueabi-gcc -O2 -g -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -c build/c/shell.c -o build/shell.o
arm-linux-gnueabi-gcc -rdynamic -O2 -g -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -o build/janet build/janet.o build/shell.o -lm -lpthread -lrt -ldl
arm-linux-gnueabi-gcc -rdynamic -O2 -g -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -Wl,-soname,libjanet.so.1.28 -shared -o build/libjanet.so build/janet.o build/shell.o -lm -lpthread -lrt -ldl
ar rcs build/libjanet.a build/janet.o build/shell.o
qemu-arm -L /usr/arm-linux-gnueabi/ ./build/janet tools/patch-header.janet src/include/janet.h src/conf/janetconf.h build/janet.h
bakpakin commented 1 year ago

So doing some more work on this I am getting failures on https://github.com/janet-lang/janet/actions/runs/5365271129/jobs/9733985836

Starting suite ev...
arm-binfmt-P: Could not open '/lib/ld-linux.so.3': No such file or directory
error: bad slot #0, expected string, symbol, keyword or buffer, got nil
  in string/trim [src/core/string.c] on line 601
  in _while [test/suite-ev.janet] on line 33, column 28
  in _thunk [test/suite-ev.janet] (tailcall) on line 28, column 1
make: *** [Makefile:[24](https://github.com/janet-lang/janet/actions/runs/5365271129/jobs/9733985836#step:5:25)7: test] Error 1

Is this a qemu bug?

EDIT: Fixed by calling all processes in the harness with qemu recursively

bakpakin commented 1 year ago

Closing as part of https://github.com/janet-lang/janet/commit/b219b146fae97fabdeac87b3c195858d3b0ffb0e

zevv commented 1 year ago

EDIT: Fixed by calling all processes in the harness with qemu recursively

:+1: