mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-20 20:04:19 +08:00
Add TESTBIN to relibc-tests and QEMU exit device
This commit is contained in:
parent
734c7cf306
commit
e802cea77a
12
mk/qemu.mk
12
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
|
||||
|
||||
@ -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
|
||||
|
||||
45
recipes/tests/relibc-tests-bins/recipe.toml
Normal file
45
recipes/tests/relibc-tests-bins/recipe.toml
Normal file
@ -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
|
||||
"""
|
||||
@ -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"
|
||||
"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user