mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/stsquad/tags/pull-tcg-testing-revivial-210618-2' into staging
Add check-tcg machinary This restores the ability to run TCG smoke tests by using our docker infrastructure to support cross building simple tests. It represents the first step to making better cross-architecture testing available straight from the source tree ;-) v2 - fix quoting of target_compiler - make docker.py Py3 safe - tweak .travis.yml recipe - don't probe docker when HAVE_USER_DOCKER not set # gpg: Signature made Thu 21 Jun 2018 07:23:45 BST # gpg: using RSA key FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-tcg-testing-revivial-210618-2: (57 commits) .travis.yml: add check-tcg test tests/docker/Makefile.include: only force SID to NOCACHE if old docker: docker.py adding age check command tests/Makefile: call sub-makes with SKIP_DOCKER_BUILD=1 docker: docker.py add check sub-command docker: docker.py don't conflate checksums for extra_files docker: docker.py use "version" to probe usage tests: add top-level make dependency for docker builds tests/tcg/i386: extend timeout for runcom test tests/tcg: override runners for broken tests tests/tcg: add run, diff, and skip helper macros tests/Makefile.include: add [build|clean|check]-tcg targets Makefile.target: add (clean-/build-)guest-tests targets tests/tcg/Makefile: update to be called from Makefile.target tests/tcg: enable building for PowerPC docker: move debian-powerpc-cross to sid based build tests/tcg: enable building for RISCV64 tests/tcg: enable building for mips64 tests/tcg: enable building for sparc64 tests/tcg: enable building for sh4 ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -153,3 +153,11 @@ matrix:
|
||||
- TEST_CMD=""
|
||||
before_script:
|
||||
- ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; }
|
||||
- env:
|
||||
- CONFIG="--disable-system --disable-docs"
|
||||
- TEST_CMD="make check-tcg"
|
||||
script:
|
||||
- make ${MAKEFLAGS} && ${TEST_CMD} ${MAKEFLAGS}
|
||||
sudo: required
|
||||
dist: trusty
|
||||
compiler: gcc
|
||||
|
||||
+15
@@ -135,6 +135,8 @@ M: Peter Maydell <peter.maydell@linaro.org>
|
||||
L: qemu-arm@nongnu.org
|
||||
S: Maintained
|
||||
F: target/arm/
|
||||
F: tests/tcg/arm/
|
||||
F: tests/tcg/aarch64/
|
||||
F: hw/arm/
|
||||
F: hw/cpu/a*mpcore.c
|
||||
F: include/hw/cpu/a*mpcore.h
|
||||
@@ -283,6 +285,8 @@ M: Richard Henderson <rth@twiddle.net>
|
||||
M: Eduardo Habkost <ehabkost@redhat.com>
|
||||
S: Maintained
|
||||
F: target/i386/
|
||||
F: tests/tcg/i386/
|
||||
F: tests/tcg/x86_64/
|
||||
F: hw/i386/
|
||||
F: disas/i386.c
|
||||
T: git git://github.com/ehabkost/qemu.git x86-next
|
||||
@@ -303,6 +307,10 @@ F: target/tricore/
|
||||
F: hw/tricore/
|
||||
F: include/hw/tricore/
|
||||
|
||||
Multiarch Linux User Tests
|
||||
M: Alex Bennée <alex.bennee@linaro.org>
|
||||
F: tests/tcg/multiarch/
|
||||
|
||||
Guest CPU Cores (KVM):
|
||||
----------------------
|
||||
|
||||
@@ -2149,6 +2157,13 @@ W: https://travis-ci.org/qemu/qemu
|
||||
W: https://app.shippable.com/github/qemu/qemu
|
||||
W: http://patchew.org/QEMU/
|
||||
|
||||
Guest Test Compilation Support
|
||||
M: Alex Bennée <alex.bennee@linaro.org>
|
||||
R: Philippe Mathieu-Daudé <f4bug@amsat.org>
|
||||
F: tests/tcg/Makefile
|
||||
F: tests/tcg/Makefile.include
|
||||
L: qemu-devel@nongnu.org
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Build system architecture
|
||||
|
||||
@@ -36,6 +36,11 @@ endif
|
||||
PROGS=$(QEMU_PROG) $(QEMU_PROGW)
|
||||
STPFILES=
|
||||
|
||||
# Makefile Tests
|
||||
ifdef CONFIG_USER_ONLY
|
||||
include $(SRC_PATH)/tests/tcg/Makefile.include
|
||||
endif
|
||||
|
||||
config-target.h: config-target.h-timestamp
|
||||
config-target.h-timestamp: config-target.mak
|
||||
|
||||
|
||||
@@ -289,7 +289,6 @@ libs_softmmu=""
|
||||
libs_tools=""
|
||||
audio_pt_int=""
|
||||
audio_win_int=""
|
||||
cc_i386=i386-pc-linux-gnu-gcc
|
||||
libs_qga=""
|
||||
debug_info="yes"
|
||||
stack_protector=""
|
||||
@@ -458,6 +457,19 @@ vxhs=""
|
||||
libxml2=""
|
||||
docker="no"
|
||||
|
||||
# cross compilers defaults, can be overridden with --cross-cc-ARCH
|
||||
cross_cc_aarch64="aarch64-linux-gnu-gcc"
|
||||
cross_cc_aarch64_be="$cross_cc_aarch64"
|
||||
cross_cc_cflags_aarch64_be="-mbig-endian"
|
||||
cross_cc_arm="arm-linux-gnueabihf-gcc"
|
||||
cross_cc_cflags_armeb="-mbig-endian"
|
||||
cross_cc_i386="i386-pc-linux-gnu-gcc"
|
||||
cross_cc_cflags_i386=""
|
||||
cross_cc_powerpc="powerpc-linux-gnu-gcc"
|
||||
cross_cc_powerpc="powerpc-linux-gnu-gcc"
|
||||
|
||||
enabled_cross_compilers=""
|
||||
|
||||
supported_cpu="no"
|
||||
supported_os="no"
|
||||
bogus_os="no"
|
||||
@@ -488,6 +500,14 @@ for opt do
|
||||
;;
|
||||
--disable-debug-info) debug_info="no"
|
||||
;;
|
||||
--cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
|
||||
;;
|
||||
--cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
|
||||
eval "cross_cc_cflags_${cc_arch}=\$optarg"
|
||||
;;
|
||||
--cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
|
||||
eval "cross_cc_${cc_arch}=\$optarg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# OS specific
|
||||
@@ -676,30 +696,37 @@ case "$cpu" in
|
||||
ppc|ppc64|s390|s390x|sparc64|x32)
|
||||
cpu="$cpu"
|
||||
supported_cpu="yes"
|
||||
eval "cross_cc_${cpu}=\$host_cc"
|
||||
;;
|
||||
i386|i486|i586|i686|i86pc|BePC)
|
||||
cpu="i386"
|
||||
supported_cpu="yes"
|
||||
cross_cc_i386=$host_cc
|
||||
;;
|
||||
x86_64|amd64)
|
||||
cpu="x86_64"
|
||||
supported_cpu="yes"
|
||||
cross_cc_x86_64=$host_cc
|
||||
;;
|
||||
armv*b|armv*l|arm)
|
||||
cpu="arm"
|
||||
supported_cpu="yes"
|
||||
cross_cc_arm=$host_cc
|
||||
;;
|
||||
aarch64)
|
||||
cpu="aarch64"
|
||||
supported_cpu="yes"
|
||||
cross_cc_aarch64=$host_cc
|
||||
;;
|
||||
mips*)
|
||||
cpu="mips"
|
||||
supported_cpu="yes"
|
||||
cross_cc_mips=$host_cc
|
||||
;;
|
||||
sparc|sun4[cdmuv])
|
||||
cpu="sparc"
|
||||
supported_cpu="yes"
|
||||
cross_cc_sparc=$host_cc
|
||||
;;
|
||||
*)
|
||||
# This will result in either an error or falling back to TCI later
|
||||
@@ -917,6 +944,8 @@ for opt do
|
||||
;;
|
||||
--disable-debug-info)
|
||||
;;
|
||||
--cross-cc-*)
|
||||
;;
|
||||
--enable-modules)
|
||||
modules="yes"
|
||||
;;
|
||||
@@ -1402,31 +1431,44 @@ case "$cpu" in
|
||||
ppc)
|
||||
CPU_CFLAGS="-m32"
|
||||
LDFLAGS="-m32 $LDFLAGS"
|
||||
cross_cc_powerpc=$cc
|
||||
cross_cc_cflags_powerpc=$CPU_CFLAGS
|
||||
;;
|
||||
ppc64)
|
||||
CPU_CFLAGS="-m64"
|
||||
LDFLAGS="-m64 $LDFLAGS"
|
||||
cross_cc_ppc64=$cc
|
||||
cross_cc_cflags_ppc64=$CPU_CFLAGS
|
||||
;;
|
||||
sparc)
|
||||
CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
|
||||
LDFLAGS="-m32 -mv8plus $LDFLAGS"
|
||||
cross_cc_sparc=$cc
|
||||
cross_cc_cflags_sparc=$CPU_CFLAGS
|
||||
;;
|
||||
sparc64)
|
||||
CPU_CFLAGS="-m64 -mcpu=ultrasparc"
|
||||
LDFLAGS="-m64 $LDFLAGS"
|
||||
cross_cc_sparc64=$cc
|
||||
cross_cc_cflags_sparc64=$CPU_CFLAGS
|
||||
;;
|
||||
s390)
|
||||
CPU_CFLAGS="-m31"
|
||||
LDFLAGS="-m31 $LDFLAGS"
|
||||
cross_cc_s390=$cc
|
||||
cross_cc_cflags_s390=$CPU_CFLAGS
|
||||
;;
|
||||
s390x)
|
||||
CPU_CFLAGS="-m64"
|
||||
LDFLAGS="-m64 $LDFLAGS"
|
||||
cross_cc_s390x=$cc
|
||||
cross_cc_cflags_s390x=$CPU_CFLAGS
|
||||
;;
|
||||
i386)
|
||||
CPU_CFLAGS="-m32"
|
||||
LDFLAGS="-m32 $LDFLAGS"
|
||||
cc_i386='$(CC) -m32'
|
||||
cross_cc_i386=$cc
|
||||
cross_cc_cflags_i386=$CPU_CFLAGS
|
||||
;;
|
||||
x86_64)
|
||||
# ??? Only extremely old AMD cpus do not have cmpxchg16b.
|
||||
@@ -1434,12 +1476,14 @@ case "$cpu" in
|
||||
# runtime and generate the fallback to serial emulation.
|
||||
CPU_CFLAGS="-m64 -mcx16"
|
||||
LDFLAGS="-m64 $LDFLAGS"
|
||||
cc_i386='$(CC) -m32'
|
||||
cross_cc_x86_64=$cc
|
||||
cross_cc_cflags_x86_64=$CPU_CFLAGS
|
||||
;;
|
||||
x32)
|
||||
CPU_CFLAGS="-mx32"
|
||||
LDFLAGS="-mx32 $LDFLAGS"
|
||||
cc_i386='$(CC) -m32'
|
||||
cross_cc_i386=$cc
|
||||
cross_cc_cflags_i386=$CPU_CFLAGS
|
||||
;;
|
||||
# No special flags required for other host CPUs
|
||||
esac
|
||||
@@ -1501,6 +1545,8 @@ Advanced options (experts only):
|
||||
--extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
|
||||
--extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
|
||||
--extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
|
||||
--cross-cc-ARCH=CC use compiler when building ARCH guest test cases
|
||||
--cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests
|
||||
--make=MAKE use specified make [$make]
|
||||
--install=INSTALL use specified install [$install]
|
||||
--python=PYTHON use specified python [$python]
|
||||
@@ -6702,7 +6748,6 @@ echo "CC=$cc" >> $config_host_mak
|
||||
if $iasl -h > /dev/null 2>&1; then
|
||||
echo "IASL=$iasl" >> $config_host_mak
|
||||
fi
|
||||
echo "CC_I386=$cc_i386" >> $config_host_mak
|
||||
echo "HOST_CC=$host_cc" >> $config_host_mak
|
||||
echo "CXX=$cxx" >> $config_host_mak
|
||||
echo "OBJCC=$objcc" >> $config_host_mak
|
||||
@@ -6821,6 +6866,10 @@ case "$target" in
|
||||
;;
|
||||
esac
|
||||
|
||||
target_compiler=""
|
||||
target_compiler_static=""
|
||||
target_compiler_cflags=""
|
||||
|
||||
mkdir -p $target_dir
|
||||
echo "# Automatically generated by configure - do not modify" > $config_target_mak
|
||||
|
||||
@@ -6836,19 +6885,25 @@ TARGET_ABI_DIR=""
|
||||
case "$target_name" in
|
||||
i386)
|
||||
gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
|
||||
target_compiler=$cross_cc_i386
|
||||
target_compiler_cflags=$cross_cc_ccflags_i386
|
||||
;;
|
||||
x86_64)
|
||||
TARGET_BASE_ARCH=i386
|
||||
gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml"
|
||||
target_compiler=$cross_cc_x86_64
|
||||
;;
|
||||
alpha)
|
||||
mttcg="yes"
|
||||
target_compiler=$cross_cc_alpha
|
||||
;;
|
||||
arm|armeb)
|
||||
TARGET_ARCH=arm
|
||||
bflt="yes"
|
||||
mttcg="yes"
|
||||
gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
|
||||
target_compiler=$cross_cc_arm
|
||||
eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}"
|
||||
;;
|
||||
aarch64|aarch64_be)
|
||||
TARGET_ARCH=aarch64
|
||||
@@ -6856,59 +6911,75 @@ case "$target_name" in
|
||||
bflt="yes"
|
||||
mttcg="yes"
|
||||
gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
|
||||
target_compiler=$cross_cc_aarch64
|
||||
eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}"
|
||||
;;
|
||||
cris)
|
||||
target_compiler=$cross_cc_cris
|
||||
;;
|
||||
hppa)
|
||||
mttcg="yes"
|
||||
target_compiler=$cross_cc_hppa
|
||||
;;
|
||||
lm32)
|
||||
target_compiler=$cross_cc_lm32
|
||||
;;
|
||||
m68k)
|
||||
bflt="yes"
|
||||
gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
|
||||
target_compiler=$cross_cc_m68k
|
||||
;;
|
||||
microblaze|microblazeel)
|
||||
TARGET_ARCH=microblaze
|
||||
bflt="yes"
|
||||
echo "TARGET_ABI32=y" >> $config_target_mak
|
||||
target_compiler=$cross_cc_microblaze
|
||||
;;
|
||||
mips|mipsel)
|
||||
TARGET_ARCH=mips
|
||||
target_compiler=$cross_cc_mips
|
||||
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
|
||||
;;
|
||||
mipsn32|mipsn32el)
|
||||
TARGET_ARCH=mips64
|
||||
TARGET_BASE_ARCH=mips
|
||||
target_compiler=$cross_cc_mipsn32
|
||||
echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
|
||||
echo "TARGET_ABI32=y" >> $config_target_mak
|
||||
;;
|
||||
mips64|mips64el)
|
||||
TARGET_ARCH=mips64
|
||||
TARGET_BASE_ARCH=mips
|
||||
target_compiler=$cross_cc_mips64
|
||||
echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
|
||||
;;
|
||||
moxie)
|
||||
target_compiler=$cross_cc_moxie
|
||||
;;
|
||||
nios2)
|
||||
target_compiler=$cross_cc_nios2
|
||||
;;
|
||||
or1k)
|
||||
target_compiler=$cross_cc_or1k
|
||||
TARGET_ARCH=openrisc
|
||||
TARGET_BASE_ARCH=openrisc
|
||||
;;
|
||||
ppc)
|
||||
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
||||
target_compiler=$cross_cc_powerpc
|
||||
;;
|
||||
ppcemb)
|
||||
TARGET_BASE_ARCH=ppc
|
||||
TARGET_ABI_DIR=ppc
|
||||
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
||||
target_compiler=$cross_cc_ppcemb
|
||||
;;
|
||||
ppc64)
|
||||
TARGET_BASE_ARCH=ppc
|
||||
TARGET_ABI_DIR=ppc
|
||||
mttcg=yes
|
||||
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
|
||||
target_compiler=$cross_cc_ppc64
|
||||
;;
|
||||
ppc64le)
|
||||
TARGET_ARCH=ppc64
|
||||
@@ -6916,6 +6987,7 @@ case "$target_name" in
|
||||
TARGET_ABI_DIR=ppc
|
||||
mttcg=yes
|
||||
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
|
||||
target_compiler=$cross_cc_ppc64le
|
||||
;;
|
||||
ppc64abi32)
|
||||
TARGET_ARCH=ppc64
|
||||
@@ -6923,45 +6995,57 @@ case "$target_name" in
|
||||
TARGET_ABI_DIR=ppc
|
||||
echo "TARGET_ABI32=y" >> $config_target_mak
|
||||
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
|
||||
target_compiler=$cross_cc_ppc64abi32
|
||||
;;
|
||||
riscv32)
|
||||
TARGET_BASE_ARCH=riscv
|
||||
TARGET_ABI_DIR=riscv
|
||||
mttcg=yes
|
||||
target_compiler=$cross_cc_riscv32
|
||||
;;
|
||||
riscv64)
|
||||
TARGET_BASE_ARCH=riscv
|
||||
TARGET_ABI_DIR=riscv
|
||||
mttcg=yes
|
||||
target_compiler=$cross_cc_riscv64
|
||||
;;
|
||||
sh4|sh4eb)
|
||||
TARGET_ARCH=sh4
|
||||
bflt="yes"
|
||||
target_compiler=$cross_cc_sh4
|
||||
;;
|
||||
sparc)
|
||||
target_compiler=$cross_cc_sparc
|
||||
;;
|
||||
sparc64)
|
||||
TARGET_BASE_ARCH=sparc
|
||||
target_compiler=$cross_cc_sparc64
|
||||
;;
|
||||
sparc32plus)
|
||||
TARGET_ARCH=sparc64
|
||||
TARGET_BASE_ARCH=sparc
|
||||
TARGET_ABI_DIR=sparc
|
||||
target_compiler=$cross_cc_sparc32plus
|
||||
echo "TARGET_ABI32=y" >> $config_target_mak
|
||||
;;
|
||||
s390x)
|
||||
mttcg=yes
|
||||
gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
|
||||
target_compiler=$cross_cc_s390x
|
||||
;;
|
||||
tilegx)
|
||||
target_compiler=$cross_cc_tilegx
|
||||
;;
|
||||
tricore)
|
||||
target_compiler=$cross_cc_tricore
|
||||
;;
|
||||
unicore32)
|
||||
target_compiler=$cross_cc_unicore32
|
||||
;;
|
||||
xtensa|xtensaeb)
|
||||
TARGET_ARCH=xtensa
|
||||
mttcg="yes"
|
||||
target_compiler=$cross_cc_xtensa
|
||||
;;
|
||||
*)
|
||||
error_exit "Unsupported target CPU"
|
||||
@@ -6972,6 +7056,27 @@ if [ "$TARGET_BASE_ARCH" = "" ]; then
|
||||
TARGET_BASE_ARCH=$TARGET_ARCH
|
||||
fi
|
||||
|
||||
# Do we have a cross compiler for this target?
|
||||
if has $target_compiler; then
|
||||
|
||||
write_c_skeleton
|
||||
|
||||
if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC -static ; then
|
||||
# For host systems we might get away with building without -static
|
||||
if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC ; then
|
||||
target_compiler=""
|
||||
else
|
||||
enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'"
|
||||
target_compiler_static="n"
|
||||
fi
|
||||
else
|
||||
enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'"
|
||||
target_compiler_static="y"
|
||||
fi
|
||||
else
|
||||
target_compiler=""
|
||||
fi
|
||||
|
||||
symlink "$source_path/Makefile.target" "$target_dir/Makefile"
|
||||
|
||||
upper() {
|
||||
@@ -7045,6 +7150,19 @@ if test "$target_bsd_user" = "yes" ; then
|
||||
echo "CONFIG_BSD_USER=y" >> $config_target_mak
|
||||
fi
|
||||
|
||||
if test -n "$target_compiler"; then
|
||||
echo "CROSS_CC_GUEST=\"$target_compiler\"" >> $config_target_mak
|
||||
|
||||
if test -n "$target_compiler_static"; then
|
||||
echo "CROSS_CC_GUEST_STATIC=$target_compiler_static" >> $config_target_mak
|
||||
fi
|
||||
|
||||
if test -n "$target_compiler_cflags"; then
|
||||
echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# generate QEMU_CFLAGS/LDFLAGS for targets
|
||||
|
||||
cflags=""
|
||||
@@ -7167,6 +7285,11 @@ echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
|
||||
|
||||
done # for target in $targets
|
||||
|
||||
if test -n "$enabled_cross_compilers"; then
|
||||
echo
|
||||
echo "NOTE: cross-compilers enabled: $enabled_cross_compilers"
|
||||
fi
|
||||
|
||||
if [ "$fdt" = "git" ]; then
|
||||
echo "config-host.h: subdir-dtc" >> $config_host_mak
|
||||
fi
|
||||
|
||||
+37
-1
@@ -10,6 +10,7 @@ check-help:
|
||||
@echo " $(MAKE) check-speed Run qobject speed tests"
|
||||
@echo " $(MAKE) check-qapi-schema Run QAPI schema tests"
|
||||
@echo " $(MAKE) check-block Run block tests"
|
||||
@echo " $(MAKE) check-tcg Run TCG tests"
|
||||
@echo " $(MAKE) check-report.html Generates an HTML test report"
|
||||
@echo " $(MAKE) check-clean Clean the tests"
|
||||
@echo
|
||||
@@ -930,6 +931,42 @@ check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check
|
||||
check-report.html: check-report.xml
|
||||
$(call quiet-command,gtester-report $< > $@,"GEN","$@")
|
||||
|
||||
# Per guest TCG tests
|
||||
|
||||
LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_LIST))
|
||||
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
|
||||
CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
|
||||
RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))
|
||||
|
||||
ifeq ($(HAVE_USER_DOCKER),y)
|
||||
# Probe for the Docker Builds needed for each build
|
||||
$(foreach PROBE_TARGET,$(TARGET_LIST), \
|
||||
$(eval -include $(SRC_PATH)/tests/tcg/Makefile.probe) \
|
||||
$(if $(DOCKER_PREREQ), \
|
||||
$(eval build-tcg-tests-$(PROBE_TARGET): $(DOCKER_PREREQ))))
|
||||
endif
|
||||
|
||||
build-tcg-tests-%:
|
||||
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" \
|
||||
SKIP_DOCKER_BUILD=1 TARGET_DIR="$*/" guest-tests, \
|
||||
"BUILD", "TCG tests for $*")
|
||||
|
||||
run-tcg-tests-%: % build-tcg-tests-%
|
||||
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" \
|
||||
SKIP_DOCKER_BUILD=1 TARGET_DIR="$*/" run-guest-tests, \
|
||||
"RUN", "TCG tests for $*")
|
||||
|
||||
clean-tcg-tests-%:
|
||||
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" clean-guest-tests,)
|
||||
|
||||
.PHONY: build-tcg
|
||||
build-tcg: $(BUILD_TCG_TARGET_RULES)
|
||||
|
||||
.PHONY: check-tcg
|
||||
check-tcg: $(RUN_TCG_TARGET_RULES)
|
||||
|
||||
.PHONY: clean-tcg
|
||||
clean-tcg: $(CLEAN_TCG_TARGET_RULES)
|
||||
|
||||
# Other tests
|
||||
|
||||
@@ -972,7 +1009,6 @@ check-speed: $(patsubst %,check-%, $(check-speed-y))
|
||||
check-block: $(patsubst %,check-%, $(check-block-y))
|
||||
check: check-qapi-schema check-unit check-qtest check-decodetree
|
||||
check-clean:
|
||||
$(MAKE) -C tests/tcg clean
|
||||
rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
|
||||
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
|
||||
rm -f tests/test-qapi-gen-timestamp
|
||||
|
||||
@@ -15,6 +15,8 @@ DOCKER_TESTS := $(notdir $(shell \
|
||||
|
||||
DOCKER_TOOLS := travis
|
||||
|
||||
DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py
|
||||
|
||||
TESTS ?= %
|
||||
IMAGES ?= %
|
||||
|
||||
@@ -32,20 +34,27 @@ docker-qemu-src: $(DOCKER_SRC_COPY)
|
||||
|
||||
docker-image: ${DOCKER_TARGETS}
|
||||
|
||||
# General rule for building docker images
|
||||
# General rule for building docker images. If we are a sub-make
|
||||
# invoked with SKIP_DOCKER_BUILD we still check the image is upto date
|
||||
# though
|
||||
ifdef SKIP_DOCKER_BUILD
|
||||
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
|
||||
$(call quiet-command, \
|
||||
$(DOCKER_SCRIPT) check --quiet qemu:$* $<, \
|
||||
"CHECK", "$*")
|
||||
else
|
||||
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
|
||||
@if test "$@" = docker-image-debian-bootstrap -a -z "$(EXECUTABLE)"; then \
|
||||
echo WARNING: EXECUTABLE is not set, debootstrap may fail. 2>&1 ; \
|
||||
fi
|
||||
$(call quiet-command,\
|
||||
$(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \
|
||||
$(DOCKER_SCRIPT) build qemu:$* $< \
|
||||
$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
|
||||
$(if $(NOUSER),,--add-current-user) \
|
||||
$(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\
|
||||
$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
|
||||
"BUILD","$*")
|
||||
|
||||
docker-image-debian-powerpc-cross: EXTRA_FILES:=$(SRC_PATH)/tests/docker/dockerfiles/debian-apt-fake.sh
|
||||
endif
|
||||
|
||||
# Enforce dependencies for composite images
|
||||
docker-image-debian: docker-image-debian9
|
||||
@@ -55,12 +64,34 @@ docker-image-debian-armel-cross: docker-image-debian9
|
||||
docker-image-debian-armhf-cross: docker-image-debian9
|
||||
docker-image-debian-arm64-cross: docker-image-debian9
|
||||
docker-image-debian-mips-cross: docker-image-debian9
|
||||
docker-image-debian-mipsel-cross: docker-image-debian9
|
||||
docker-image-debian-mips64el-cross: docker-image-debian9
|
||||
docker-image-debian-powerpc-cross: docker-image-debian8
|
||||
docker-image-debian-ppc64el-cross: docker-image-debian9
|
||||
docker-image-debian-s390x-cross: docker-image-debian9
|
||||
docker-image-debian-win32-cross: docker-image-debian8-mxe
|
||||
docker-image-debian-win64-cross: docker-image-debian8-mxe
|
||||
|
||||
# Debian SID images - we are tracking a rolling distro so we want to
|
||||
# force a re-build of the base image if we ever need to build one of
|
||||
# its children.
|
||||
ifndef SKIP_DOCKER_BUILD
|
||||
ifeq ($(HAVE_USER_DOCKER),y)
|
||||
SID_AGE=$(shell $(DOCKER_SCRIPT) check --checktype=age --olderthan=180 --quiet qemu:debian-sid)
|
||||
ifeq ($(SID_AGE),)
|
||||
else
|
||||
docker-image-debian-sid: NOCACHE=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
docker-image-debian-alpha-cross: docker-image-debian-sid
|
||||
docker-image-debian-hppa-cross: docker-image-debian-sid
|
||||
docker-image-debian-m68k-cross: docker-image-debian-sid
|
||||
docker-image-debian-sh4-cross: docker-image-debian-sid
|
||||
docker-image-debian-sparc64-cross: docker-image-debian-sid
|
||||
docker-image-debian-mips64-cross: docker-image-debian-sid
|
||||
docker-image-debian-riscv64-cross: docker-image-debian-sid
|
||||
docker-image-debian-powerpc-cross: docker-image-debian-sid
|
||||
docker-image-travis: NOUSER=1
|
||||
|
||||
# Specialist build images, sometimes very limited tools
|
||||
@@ -133,11 +164,11 @@ docker-run: docker-qemu-src
|
||||
fi
|
||||
$(if $(EXECUTABLE), \
|
||||
$(call quiet-command, \
|
||||
$(SRC_PATH)/tests/docker/docker.py update \
|
||||
$(DOCKER_SCRIPT) update \
|
||||
$(IMAGE) $(EXECUTABLE), \
|
||||
" COPYING $(EXECUTABLE) to $(IMAGE)"))
|
||||
$(call quiet-command, \
|
||||
$(SRC_PATH)/tests/docker/docker.py run \
|
||||
$(DOCKER_SCRIPT) run \
|
||||
$(if $(NOUSER),,-u $(shell id -u)) \
|
||||
--security-opt seccomp=unconfined \
|
||||
$(if $V,,--rm) \
|
||||
@@ -167,4 +198,4 @@ docker-run-%:
|
||||
@$(MAKE) docker-run TEST=$(CMD) IMAGE=qemu:$(IMAGE)
|
||||
|
||||
docker-clean:
|
||||
$(call quiet-command, $(SRC_PATH)/tests/docker/docker.py clean)
|
||||
$(call quiet-command, $(DOCKER_SCRIPT) clean)
|
||||
|
||||
+106
-6
@@ -26,9 +26,13 @@ import tempfile
|
||||
import re
|
||||
import signal
|
||||
from tarfile import TarFile, TarInfo
|
||||
from StringIO import StringIO
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
from shutil import copy, rmtree
|
||||
from pwd import getpwuid
|
||||
from datetime import datetime,timedelta
|
||||
|
||||
|
||||
FILTERED_ENV_NAMES = ['ftp_proxy', 'http_proxy', 'https_proxy']
|
||||
@@ -49,7 +53,9 @@ def _guess_docker_command():
|
||||
commands = [["docker"], ["sudo", "-n", "docker"]]
|
||||
for cmd in commands:
|
||||
try:
|
||||
if subprocess.call(cmd + ["images"],
|
||||
# docker version will return the client details in stdout
|
||||
# but still report a status of 1 if it can't contact the daemon
|
||||
if subprocess.call(cmd + ["version"],
|
||||
stdout=DEVNULL, stderr=DEVNULL) == 0:
|
||||
return cmd
|
||||
except OSError:
|
||||
@@ -179,8 +185,17 @@ class Docker(object):
|
||||
stderr=subprocess.STDOUT,
|
||||
**kwargs)
|
||||
|
||||
def inspect_tag(self, tag):
|
||||
try:
|
||||
return self._output(["inspect", tag])
|
||||
except subprocess.CalledProcessError:
|
||||
return None
|
||||
|
||||
def get_image_creation_time(self, info):
|
||||
return json.loads(info)[0]["Created"]
|
||||
|
||||
def get_image_dockerfile_checksum(self, tag):
|
||||
resp = self._output(["inspect", tag])
|
||||
resp = self.inspect_tag(tag)
|
||||
labels = json.loads(resp)[0]["Config"].get("Labels", {})
|
||||
return labels.get("com.qemu.dockerfile-checksum", "")
|
||||
|
||||
@@ -201,8 +216,10 @@ class Docker(object):
|
||||
|
||||
tmp_df.write("\n")
|
||||
tmp_df.write("LABEL com.qemu.dockerfile-checksum=%s" %
|
||||
_text_checksum("\n".join([dockerfile] +
|
||||
extra_files_cksum)))
|
||||
_text_checksum(_dockerfile_preprocess(dockerfile)))
|
||||
for f, c in extra_files_cksum:
|
||||
tmp_df.write("LABEL com.qemu.%s-checksum=%s" % (f, c))
|
||||
|
||||
tmp_df.flush()
|
||||
|
||||
self._do_check(["build", "-t", tag, "-f", tmp_df.name] + argv + \
|
||||
@@ -317,7 +334,7 @@ class BuildCommand(SubCommand):
|
||||
_copy_binary_with_libs(args.include_executable, docker_dir)
|
||||
for filename in args.extra_files or []:
|
||||
_copy_with_mkdir(filename, docker_dir)
|
||||
cksum += [_file_checksum(filename)]
|
||||
cksum += [(filename, _file_checksum(filename))]
|
||||
|
||||
argv += ["--build-arg=" + k.lower() + "=" + v
|
||||
for k, v in os.environ.iteritems()
|
||||
@@ -409,6 +426,89 @@ class ProbeCommand(SubCommand):
|
||||
return
|
||||
|
||||
|
||||
class CcCommand(SubCommand):
|
||||
"""Compile sources with cc in images"""
|
||||
name = "cc"
|
||||
|
||||
def args(self, parser):
|
||||
parser.add_argument("--image", "-i", required=True,
|
||||
help="The docker image in which to run cc")
|
||||
parser.add_argument("--cc", default="cc",
|
||||
help="The compiler executable to call")
|
||||
parser.add_argument("--user",
|
||||
help="The user-id to run under")
|
||||
parser.add_argument("--source-path", "-s", nargs="*", dest="paths",
|
||||
help="""Extra paths to (ro) mount into container for
|
||||
reading sources""")
|
||||
|
||||
def run(self, args, argv):
|
||||
if argv and argv[0] == "--":
|
||||
argv = argv[1:]
|
||||
cwd = os.getcwd()
|
||||
cmd = ["--rm", "-w", cwd,
|
||||
"-v", "%s:%s:rw" % (cwd, cwd)]
|
||||
if args.paths:
|
||||
for p in args.paths:
|
||||
cmd += ["-v", "%s:%s:ro,z" % (p, p)]
|
||||
if args.user:
|
||||
cmd += ["-u", args.user]
|
||||
cmd += [args.image, args.cc]
|
||||
cmd += argv
|
||||
return Docker().command("run", cmd, args.quiet)
|
||||
|
||||
|
||||
class CheckCommand(SubCommand):
|
||||
"""Check if we need to re-build a docker image out of a dockerfile.
|
||||
Arguments: <tag> <dockerfile>"""
|
||||
name = "check"
|
||||
|
||||
def args(self, parser):
|
||||
parser.add_argument("tag",
|
||||
help="Image Tag")
|
||||
parser.add_argument("dockerfile", default=None,
|
||||
help="Dockerfile name", nargs='?')
|
||||
parser.add_argument("--checktype", choices=["checksum", "age"],
|
||||
default="checksum", help="check type")
|
||||
parser.add_argument("--olderthan", default=60, type=int,
|
||||
help="number of minutes")
|
||||
|
||||
def run(self, args, argv):
|
||||
tag = args.tag
|
||||
|
||||
dkr = Docker()
|
||||
info = dkr.inspect_tag(tag)
|
||||
if info is None:
|
||||
print("Image does not exist")
|
||||
return 1
|
||||
|
||||
if args.checktype == "checksum":
|
||||
if not args.dockerfile:
|
||||
print("Need a dockerfile for tag:%s" % (tag))
|
||||
return 1
|
||||
|
||||
dockerfile = open(args.dockerfile, "rb").read()
|
||||
|
||||
if dkr.image_matches_dockerfile(tag, dockerfile):
|
||||
if not args.quiet:
|
||||
print("Image is up to date")
|
||||
return 0
|
||||
else:
|
||||
print("Image needs updating")
|
||||
return 1
|
||||
elif args.checktype == "age":
|
||||
timestr = dkr.get_image_creation_time(info).split(".")[0]
|
||||
created = datetime.strptime(timestr, "%Y-%m-%dT%H:%M:%S")
|
||||
past = datetime.now() - timedelta(minutes=args.olderthan)
|
||||
if created < past:
|
||||
print ("Image created @ %s more than %d minutes old" %
|
||||
(timestr, args.olderthan))
|
||||
return 1
|
||||
else:
|
||||
if not args.quiet:
|
||||
print ("Image less than %d minutes old" % (args.olderthan))
|
||||
return 0
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="A Docker helper",
|
||||
usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Docker cross-compiler target
|
||||
#
|
||||
# This docker target builds on the debian sid base image which
|
||||
# contains cross compilers for Debian "ports" targets.
|
||||
#
|
||||
FROM qemu:debian-sid
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc-alpha-linux-gnu \
|
||||
libc6.1-dev-alpha-cross || { echo "Failed to build - see debian-sid.docker notes"; exit 1; }
|
||||
@@ -1,46 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Generate fake debian package to resolve unimportant unmet dependencies held
|
||||
# by upstream multiarch broken packages.
|
||||
#
|
||||
# Copyright (c) 2017 Philippe Mathieu-Daudé <f4bug@amsat.org>
|
||||
#
|
||||
# This work is licensed under the terms of the GNU GPL, version 2
|
||||
# or (at your option) any later version. See the COPYING file in
|
||||
# the top-level directory.
|
||||
|
||||
test $1 = "install" && shift 1
|
||||
|
||||
fake_install()
|
||||
{
|
||||
echo "Generating fake $2 $1 $3 ..."
|
||||
(cd /var/cache/apt/archives
|
||||
(cat << 'EOF'
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
|
||||
Package: NAME
|
||||
Version: VERSION
|
||||
Maintainer: qemu-devel@nongnu.org
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Description: fake NAME
|
||||
EOF
|
||||
) | sed s/NAME/$2/g | sed s/VERSION/$3/g > $2.control
|
||||
equivs-build -a $1 $2.control 1>/dev/null 2>/dev/null
|
||||
dpkg -i --force-overwrite $2_$3_$1.deb
|
||||
)
|
||||
}
|
||||
|
||||
try_install()
|
||||
{
|
||||
name=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\1/")
|
||||
arch=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\2/")
|
||||
vers=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\3/")
|
||||
apt-get install -q -yy $1 || fake_install $arch $name $vers
|
||||
}
|
||||
|
||||
for package in $*; do
|
||||
try_install $package
|
||||
done
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Docker cross-compiler target
|
||||
#
|
||||
# This docker target builds on the debian sid base image which
|
||||
# contains cross compilers for Debian "ports" targets.
|
||||
#
|
||||
FROM qemu:debian-sid
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc-hppa-linux-gnu \
|
||||
libc6-dev-hppa-cross
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Docker cross-compiler target
|
||||
#
|
||||
# This docker target builds on the debian sid base image which
|
||||
# contains cross compilers for Debian "ports" targets.
|
||||
#
|
||||
FROM qemu:debian-sid
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc-m68k-linux-gnu \
|
||||
libc6-dev-m68k-cross
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Docker cross-compiler target
|
||||
#
|
||||
# This docker target builds on the debian sid base image which
|
||||
# contains cross compilers for Debian "ports" targets.
|
||||
#
|
||||
FROM qemu:debian-sid
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc-mips64-linux-gnuabi64 \
|
||||
libc6-dev-mips64-cross
|
||||
@@ -1,40 +1,13 @@
|
||||
#
|
||||
# Docker powerpc cross-compiler target
|
||||
#
|
||||
# This docker target builds on the debian Jessie base image.
|
||||
# This docker target builds on the debian sid base image which
|
||||
# contains cross compilers for Debian "ports" targets. The original
|
||||
# Jessie based no longer builds.
|
||||
#
|
||||
FROM qemu:debian8
|
||||
MAINTAINER Philippe Mathieu-Daudé <f4bug@amsat.org>
|
||||
|
||||
# Add the foreign architecture we want and install dependencies
|
||||
RUN dpkg --add-architecture powerpc
|
||||
RUN apt-get update
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get install -y --no-install-recommends \
|
||||
crossbuild-essential-powerpc
|
||||
|
||||
# <kludge> to fix "following packages have unmet dependencies" ...
|
||||
ADD debian-apt-fake.sh /usr/local/bin/apt-fake
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
equivs \
|
||||
pkg-config
|
||||
RUN apt-fake install \
|
||||
pkg-config:powerpc=0.28-1.1-fake && \
|
||||
ln -s pkg-config /usr/bin/powerpc-linux-gnu-pkg-config
|
||||
ENV PKG_CONFIG_PATH /usr/lib/powerpc-linux-gnu/pkgconfig
|
||||
# </kludge>
|
||||
|
||||
# Specify the cross prefix for this image (see tests/docker/common.rc)
|
||||
ENV QEMU_CONFIGURE_OPTS --cross-prefix=powerpc-linux-gnu-
|
||||
FROM qemu:debian-sid
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get build-dep -yy -a powerpc qemu
|
||||
RUN DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install -y --no-install-recommends \
|
||||
glusterfs-common:powerpc \
|
||||
libbz2-dev:powerpc \
|
||||
liblzo2-dev:powerpc \
|
||||
libncursesw5-dev:powerpc \
|
||||
libnfs-dev:powerpc \
|
||||
librdmacm-dev:powerpc \
|
||||
libsnappy-dev:powerpc
|
||||
gcc-powerpc-linux-gnu \
|
||||
libc6-dev-powerpc-cross || { echo "Failed to build - see debian-sid.docker notes"; exit 1; }
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Docker cross-compiler target
|
||||
#
|
||||
# This docker target builds on the debian sid base image which
|
||||
# contains cross compilers for Debian "ports" targets.
|
||||
#
|
||||
FROM qemu:debian-sid
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc-riscv64-linux-gnu \
|
||||
libc6-dev-riscv64-cross
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Docker cross-compiler target
|
||||
#
|
||||
# This docker target builds on the debian sid base image which
|
||||
# contains cross compilers for Debian "ports" targets.
|
||||
#
|
||||
FROM qemu:debian-sid
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc-sh4-linux-gnu \
|
||||
libc6-dev-sh4-cross
|
||||
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Debian Sid Base
|
||||
#
|
||||
# A number of our guests exist as ports only. We can either use the
|
||||
# ports repo or get everything from Sid. However Sid is a rolling
|
||||
# distro which may be broken at any particular time. If you are
|
||||
# unlucky and try and build your images while gcc is in the process of
|
||||
# being uploaded this can fail. Your only recourse is to try again in
|
||||
# a few hours when the repos have re-synced. Once built however you
|
||||
# won't be affected by repo changes unless the docker recipies are
|
||||
# updated and trigger a re-build.
|
||||
#
|
||||
|
||||
FROM debian:sid-slim
|
||||
|
||||
# Duplicate deb line as deb-src
|
||||
RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
|
||||
|
||||
# Install common build utilities
|
||||
RUN apt update
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt install -y --no-install-recommends \
|
||||
bison \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
flex \
|
||||
git \
|
||||
pkg-config \
|
||||
psmisc \
|
||||
python \
|
||||
texinfo || { echo "Failed to build - see debian-sid.docker notes"; exit 1; }
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Docker cross-compiler target
|
||||
#
|
||||
# This docker target builds on the debian sid base image which
|
||||
# contains cross compilers for Debian "ports" targets.
|
||||
#
|
||||
FROM qemu:debian-sid
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc-sparc64-linux-gnu \
|
||||
libc6-dev-sparc64-cross
|
||||
@@ -32,6 +32,3 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
pkg-config \
|
||||
python-minimal
|
||||
|
||||
# Setup Emdebian [emdebian-archive-keyring]
|
||||
RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/emdebian.list && \
|
||||
curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
|
||||
|
||||
+84
-139
@@ -1,156 +1,101 @@
|
||||
# -*- Mode: makefile -*-
|
||||
#
|
||||
# TCG tests
|
||||
#
|
||||
# These are complicated by the fact we want to build them for guest
|
||||
# systems. This requires knowing what guests we are building and which
|
||||
# ones we have cross-compilers for or docker images with
|
||||
# cross-compilers.
|
||||
#
|
||||
# The tests themselves should be as minimal as possible as
|
||||
# cross-compilers don't always have a large amount of libraries
|
||||
# available.
|
||||
#
|
||||
# We only include the host build system for SRC_PATH and we don't
|
||||
# bother with the common rules.mk. We expect the following:
|
||||
#
|
||||
# CC - the C compiler command
|
||||
# EXTRA_CFLAGS - any extra CFLAGS
|
||||
# BUILD_STATIC - are we building static binaries
|
||||
#
|
||||
# By default all tests are statically compiled but some host systems
|
||||
# may not package static libraries by default. If an external
|
||||
# cross-compiler can only build dynamic libraries the user might need
|
||||
# to make extra efforts to ensure ld.so can link at runtime when the
|
||||
# tests are run.
|
||||
#
|
||||
# We also accept SPEED=slow to enable slower running tests
|
||||
#
|
||||
# We also expect to be in the tests build dir for the FOO-linux-user.
|
||||
#
|
||||
|
||||
-include ../../config-host.mak
|
||||
-include $(SRC_PATH)/rules.mak
|
||||
-include ../config-target.mak
|
||||
|
||||
$(call set-vpath, $(SRC_PATH)/tests/tcg)
|
||||
quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
|
||||
|
||||
QEMU=../../i386-linux-user/qemu-i386
|
||||
QEMU_X86_64=../../x86_64-linux-user/qemu-x86_64
|
||||
CC_X86_64=$(CC_I386) -m64
|
||||
# $1 = test name, $2 = cmd, $3 = desc
|
||||
run-test = $(call quiet-command, timeout $(TIMEOUT) $2 > $1.out,"TEST",$3)
|
||||
|
||||
QEMU_INCLUDES += -I../..
|
||||
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
|
||||
#CFLAGS+=-msse2
|
||||
# $1 = test name, $2 = reference
|
||||
diff-out = $(call quiet-command, diff -u $1.out $2 | head -n 10,"DIFF","$1.out with $2")
|
||||
|
||||
# $1 = test name, $2 = reason
|
||||
skip-test = @printf " SKIPPED %s on $(TARGET_NAME) because %s\n" $1 $2
|
||||
|
||||
# Tests we are building
|
||||
TESTS=
|
||||
|
||||
# Start with a blank slate, the build targets get to add stuff first
|
||||
CFLAGS=
|
||||
QEMU_CFLAGS=
|
||||
LDFLAGS=
|
||||
|
||||
# TODO: automatically detect ARM and MIPS compilers, and run those too
|
||||
# The QEMU for this TARGET
|
||||
QEMU=../qemu-$(TARGET_NAME)
|
||||
|
||||
# runcom maps page 0, so it requires root privileges
|
||||
# also, pi_10.com runs indefinitely
|
||||
|
||||
I386_TESTS=hello-i386 \
|
||||
linux-test \
|
||||
testthread \
|
||||
sha1-i386 \
|
||||
test-i386 \
|
||||
test-i386-fprem \
|
||||
test-mmap \
|
||||
# runcom
|
||||
|
||||
# native i386 compilers sometimes are not biarch. assume cross-compilers are
|
||||
ifneq ($(ARCH),i386)
|
||||
I386_TESTS+=run-test-x86_64
|
||||
# If TCG debugging is enabled things are a lot slower
|
||||
ifeq ($(CONFIG_DEBUG_TCG),y)
|
||||
TIMEOUT=45
|
||||
else
|
||||
TIMEOUT=15
|
||||
endif
|
||||
|
||||
TESTS = test_path
|
||||
ifneq ($(call find-in-path, $(CC_I386)),)
|
||||
TESTS += $(I386_TESTS)
|
||||
# The order we include is important. We include multiarch, base arch
|
||||
# and finally arch if it's not the same as base arch.
|
||||
-include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
|
||||
-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.target
|
||||
ifneq ($(TARGET_BASE_ARCH),$(TARGET_NAME))
|
||||
-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
|
||||
endif
|
||||
|
||||
all: $(patsubst %,run-%,$(TESTS))
|
||||
test: all
|
||||
# Add the common build options
|
||||
CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
|
||||
ifeq ($(BUILD_STATIC),y)
|
||||
LDFLAGS+=-static
|
||||
endif
|
||||
|
||||
# rules to run tests
|
||||
%: %.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
|
||||
|
||||
.PHONY: $(patsubst %,run-%,$(TESTS))
|
||||
all: $(TESTS)
|
||||
|
||||
#
|
||||
# Test Runners
|
||||
#
|
||||
# By default we just run the test with the appropriate QEMU for the
|
||||
# target. More advanced tests may want to override the runner in their
|
||||
# specific make rules. Additional runners for the same binary should
|
||||
# be added to EXTRA_RUNS.
|
||||
#
|
||||
|
||||
RUN_TESTS=$(patsubst %,run-%, $(TESTS))
|
||||
RUN_TESTS+=$(EXTRA_RUNS)
|
||||
|
||||
run-%: %
|
||||
-$(QEMU) ./$*
|
||||
$(call run-test, $<, $(QEMU) $<, "$< on $(TARGET_NAME)")
|
||||
|
||||
run-hello-i386: hello-i386
|
||||
run-linux-test: linux-test
|
||||
run-testthread: testthread
|
||||
run-sha1-i386: sha1-i386
|
||||
.PHONY: run
|
||||
run: $(RUN_TESTS)
|
||||
|
||||
run-test-i386: test-i386
|
||||
./test-i386 > test-i386.ref
|
||||
-$(QEMU) test-i386 > test-i386.out
|
||||
@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
|
||||
|
||||
run-test-i386-fprem: test-i386-fprem
|
||||
./test-i386-fprem > test-i386-fprem.ref
|
||||
-$(QEMU) test-i386-fprem > test-i386-fprem.out
|
||||
@if diff -u test-i386-fprem.ref test-i386-fprem.out ; then echo "Auto Test OK"; fi
|
||||
|
||||
run-test-x86_64: test-x86_64
|
||||
./test-x86_64 > test-x86_64.ref
|
||||
-$(QEMU_X86_64) test-x86_64 > test-x86_64.out
|
||||
@if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK"; fi
|
||||
|
||||
run-test-mmap: test-mmap
|
||||
-$(QEMU) ./test-mmap
|
||||
-$(QEMU) -p 8192 ./test-mmap 8192
|
||||
-$(QEMU) -p 16384 ./test-mmap 16384
|
||||
-$(QEMU) -p 32768 ./test-mmap 32768
|
||||
|
||||
run-runcom: runcom
|
||||
-$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com
|
||||
|
||||
run-test_path: test_path
|
||||
./test_path
|
||||
|
||||
# rules to compile tests
|
||||
|
||||
test_path: test_path.o
|
||||
|
||||
test_path.o: test_path.c
|
||||
|
||||
hello-i386: hello-i386.c
|
||||
$(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
|
||||
strip $@
|
||||
|
||||
testthread: testthread.c
|
||||
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
|
||||
|
||||
# i386/x86_64 emulation test (test various opcodes) */
|
||||
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
|
||||
test-i386.h test-i386-shift.h test-i386-muldiv.h
|
||||
$(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
|
||||
|
||||
test-i386-fprem: test-i386-fprem.c
|
||||
$(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $^
|
||||
|
||||
test-x86_64: test-i386.c \
|
||||
test-i386.h test-i386-shift.h test-i386-muldiv.h
|
||||
$(CC_X86_64) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm
|
||||
|
||||
# generic Linux and CPU test
|
||||
linux-test: linux-test.c
|
||||
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
|
||||
|
||||
# vm86 test
|
||||
runcom: runcom.c
|
||||
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
|
||||
|
||||
test-mmap: test-mmap.c
|
||||
$(CC_I386) -m32 $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $<
|
||||
|
||||
# speed test
|
||||
sha1-i386: sha1.c
|
||||
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
|
||||
|
||||
sha1: sha1.c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
|
||||
|
||||
speed: sha1 sha1-i386
|
||||
time ./sha1
|
||||
time $(QEMU) ./sha1-i386
|
||||
|
||||
# arm test
|
||||
hello-arm: hello-arm.o
|
||||
arm-linux-ld -o $@ $<
|
||||
|
||||
hello-arm.o: hello-arm.c
|
||||
arm-linux-gcc -Wall -g -O2 -c -o $@ $<
|
||||
|
||||
test-arm-iwmmxt: test-arm-iwmmxt.s
|
||||
cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
|
||||
|
||||
# MIPS test
|
||||
hello-mips: hello-mips.c
|
||||
mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
|
||||
|
||||
hello-mipsel: hello-mips.c
|
||||
mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
|
||||
|
||||
# testsuite for the CRIS port.
|
||||
test-cris:
|
||||
$(MAKE) -C cris check
|
||||
|
||||
# testsuite for the LM32 port.
|
||||
test-lm32:
|
||||
$(MAKE) -C lm32 check
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o test-i386.out test-i386.ref \
|
||||
test-x86_64.log test-x86_64.ref qruncom $(TESTS)
|
||||
# There is no clean target, the calling make just rm's the tests build dir
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
# -*- Mode: makefile -*-
|
||||
#
|
||||
# TCG tests (per-target rules)
|
||||
#
|
||||
# This Makefile fragement is included from the per-target
|
||||
# Makefile.target so will be invoked for each linux-user program we
|
||||
# build. We have two options for compiling, either using a configured
|
||||
# guest compiler or calling one of our docker images to do it for us.
|
||||
#
|
||||
|
||||
# The per ARCH makefile, if it exists, holds extra information about
|
||||
# useful docker images or alternative compiler flags.
|
||||
|
||||
-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
|
||||
-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
|
||||
|
||||
GUEST_BUILD=
|
||||
TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile
|
||||
# Support installed Cross Compilers
|
||||
|
||||
ifdef CROSS_CC_GUEST
|
||||
|
||||
.PHONY: cross-build-guest-tests
|
||||
cross-build-guest-tests:
|
||||
$(call quiet-command, \
|
||||
(mkdir -p tests && cd tests && \
|
||||
$(MAKE) -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \
|
||||
BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \
|
||||
EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \
|
||||
"BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
|
||||
|
||||
GUEST_BUILD=cross-build-guest-tests
|
||||
|
||||
endif
|
||||
|
||||
# Support building with Docker
|
||||
|
||||
ifeq ($(HAVE_USER_DOCKER)$(GUEST_BUILD),y)
|
||||
ifneq ($(DOCKER_IMAGE),)
|
||||
|
||||
# We also need the Docker make rules to depend on
|
||||
include $(SRC_PATH)/tests/docker/Makefile.include
|
||||
|
||||
DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
|
||||
--cc $(DOCKER_CROSS_COMPILER) \
|
||||
-i qemu:$(DOCKER_IMAGE) \
|
||||
-s $(SRC_PATH) -- "
|
||||
DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)
|
||||
|
||||
.PHONY: docker-build-guest-tests
|
||||
docker-build-guest-tests: $(DOCKER_PREREQ)
|
||||
$(call quiet-command, \
|
||||
(mkdir -p tests && cd tests && \
|
||||
$(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
|
||||
BUILD_STATIC=y \
|
||||
EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
|
||||
"BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
|
||||
|
||||
GUEST_BUILD=docker-build-guest-tests
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
# Final targets
|
||||
.PHONY: guest-tests
|
||||
|
||||
ifneq ($(GUEST_BUILD),)
|
||||
guest-tests: $(GUEST_BUILD)
|
||||
|
||||
run-guest-tests: guest-tests qemu-$(TARGET_NAME)
|
||||
$(call quiet-command, \
|
||||
(cd tests && $(MAKE) -f $(TCG_MAKE) SPEED=$(SPEED) run), \
|
||||
"RUN", "tests for $(TARGET_NAME)")
|
||||
|
||||
else
|
||||
guest-tests:
|
||||
$(call quiet-command, /bin/true, "BUILD", \
|
||||
"$(TARGET_NAME) guest-tests SKIPPED")
|
||||
|
||||
run-guest-tests:
|
||||
$(call quiet-command, /bin/true, "RUN", \
|
||||
"tests for $(TARGET_NAME) SKIPPED")
|
||||
endif
|
||||
|
||||
# It doesn't matter if these don't exits
|
||||
.PHONY: clean-guest-tests
|
||||
clean-guest-tests:
|
||||
rm -rf tests || echo "no $(TARGET_NAME) tests to remove"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user