diff --git a/mk/qemu.mk b/mk/qemu.mk index 6d1ff622..f6114572 100644 --- a/mk/qemu.mk +++ b/mk/qemu.mk @@ -3,6 +3,7 @@ QEMU=SDL_VIDEO_X11_DGAMOUSE=0 qemu-system-$(QEMU_ARCH) QEMUFLAGS=-d guest_errors -name "Redox OS $(ARCH)" netboot?=no +redoxer?=no VGA_SUPPORTED=no ifeq ($(ARCH),i586) @@ -162,6 +163,17 @@ else QEMUFLAGS+=-serial chardev:debug -mon chardev=debug endif +# redoxer exit code: 51 => success, 53 => failure +ifeq ($(redoxer),yes) +ifeq ($(ARCH),x86_64) + QEMUFLAGS+=-device isa-debug-exit +else ifeq ($(ARCH),i586) + QEMUFLAGS+=-device isa-debug-exit +else ifeq ($(ARCH),aarch64) + QEMUFLAGS+=-semihosting-config enable=on,target=native,userspace=on +endif +endif + ifeq ($(iommu),yes) QEMUFLAGS+=-machine $(QEMU_MACHINE),iommu=on else diff --git a/recipes/tests/os-test-bins/recipe.toml b/recipes/tests/os-test-bins/recipe.toml index 5346384e..96edb9d3 100644 --- a/recipes/tests/os-test-bins/recipe.toml +++ b/recipes/tests/os-test-bins/recipe.toml @@ -6,7 +6,7 @@ template = "custom" script = """ DYNAMIC_INIT SRC=${COOKBOOK_SOURCE} -DST=${COOKBOOK_STAGE}/root +DST=${COOKBOOK_STAGE}/root/os-test if [ -z "$TESTBIN" ]; then pushd ${SRC} for file in */*/*.c; do diff --git a/recipes/tests/relibc-tests-bins/recipe.toml b/recipes/tests/relibc-tests-bins/recipe.toml new file mode 100644 index 00000000..80dfd9f6 --- /dev/null +++ b/recipes/tests/relibc-tests-bins/recipe.toml @@ -0,0 +1,45 @@ +[source] +same_as = "../../core/relibc" + +[build] +template = "custom" +script = """ +PACKAGE_PATH="tests" cookbook_cargo + +DYNAMIC_INIT +SRC=${COOKBOOK_SOURCE}/tests +EXPECTSRC=${SRC}/expected/bins_dynamic +DST=${COOKBOOK_STAGE}/root/relibc-tests +CFLAGS+=" -I${SRC}" +LDFLAGS+=" -Wl,-rpath=\\$ORIGIN" +pushd ${SRC} +if [ -z "$TESTBIN" ]; then +for file in **/*.c; do + filename="${file%.*}" + mkdir -p $(dirname $DST/$filename) + # adding "true" because compilation can fail + ${CC} ${CFLAGS} ${LDFLAGS} "$SRC/$file" -o "$DST/$filename" -Wall || true + if [[ -f "${EXPECTSRC}/$filename.stdout" ]]; then + echo "relibc-tests ./$filename" >> $DST/run.sh + else + echo "relibc-tests -s./$filename" >> $DST/run.sh + fi +done +rsync -a ${EXPECTSRC} ${DST}/expected +popd +else + mkdir -p $(dirname $DST/$TESTBIN) $(dirname $DST/expected/$TESTBIN) + ${CC} ${CFLAGS} ${LDFLAGS} "$SRC/$TESTBIN.c" -o "$DST/$TESTBIN" -Wall + if [[ -f "${EXPECTSRC}/$TESTBIN.stdout" ]]; then + cp ${EXPECTSRC}/$TESTBIN.{stdout,stderr} $(dirname $DST/expected/$TESTBIN) + fi +fi + +if [ -n "TESTBIN" ]; then +if [[ -f "${EXPECTSRC}/$TESTBIN.stdout" ]]; then +"${COOKBOOK_REDOXER}" write-exec sh -c "cd /root/relibc-tests; relibc-tests ./$TESTBIN" +else +"${COOKBOOK_REDOXER}" write-exec sh -c "cd /root/relibc-tests; relibc-tests -s./$TESTBIN" +fi +fi +""" diff --git a/recipes/tests/relibc-tests/recipe.toml b/recipes/tests/relibc-tests/recipe.toml index fa0acf92..c854833d 100644 --- a/recipes/tests/relibc-tests/recipe.toml +++ b/recipes/tests/relibc-tests/recipe.toml @@ -4,12 +4,6 @@ same_as = "../../core/relibc" [build] template = "custom" script = """ -rsync -av --delete "${COOKBOOK_SOURCE}/" ./ -pushd tests -export CARGO_TEST="${COOKBOOK_CARGO}" -export NATIVE_RELIBC=1 # to link against prefix -"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all bins_verify/relibc-tests -popd mkdir -pv "${COOKBOOK_STAGE}/share/relibc" -cp -rv "tests" "${COOKBOOK_STAGE}/share/relibc/tests" +cp -rv "${COOKBOOK_SOURCE}/tests" "${COOKBOOK_STAGE}/share/relibc-tests" """