mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 19:03:38 +08:00
tests/tcg: move architecture independent tests into subdir
We will want to build these for all supported guest architectures so lets move them all into one place. We also drop test_path at this point because it needs qemu utils and glib bits which is hard to support for cross compiling. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
e27cae268f
commit
dd28bebd02
@ -303,6 +303,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):
|
||||
----------------------
|
||||
|
||||
|
@ -18,12 +18,9 @@ LDFLAGS=
|
||||
# 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
|
||||
@ -47,8 +44,6 @@ run-%: %
|
||||
-$(QEMU) ./$*
|
||||
|
||||
run-hello-i386: hello-i386
|
||||
run-linux-test: linux-test
|
||||
run-testthread: testthread
|
||||
run-sha1-i386: sha1-i386
|
||||
|
||||
run-test-i386: test-i386
|
||||
@ -66,11 +61,6 @@ run-test-x86_64: test-x86_64
|
||||
-$(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
|
||||
@ -80,17 +70,10 @@ run-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
|
||||
@ -104,28 +87,14 @@ 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 $@ $<
|
||||
|
@ -1,9 +1,7 @@
|
||||
This directory contains various interesting programs for
|
||||
regression testing.
|
||||
|
||||
The target "make test" runs the programs and, if applicable,
|
||||
runs "diff" to detect mismatches between output on the host and
|
||||
output on QEMU.
|
||||
This directory contains various interesting guest programs for
|
||||
regression testing. Tests are either multi-arch, meaning they can be
|
||||
built for all guest architectures that support linux-user executable,
|
||||
or they are architecture specific.
|
||||
|
||||
i386
|
||||
====
|
||||
|
36
tests/tcg/multiarch/Makefile.target
Normal file
36
tests/tcg/multiarch/Makefile.target
Normal file
@ -0,0 +1,36 @@
|
||||
# -*- Mode: makefile -*-
|
||||
#
|
||||
# Multiarch Tests - included from tests/tcg/Makefile.target
|
||||
#
|
||||
# These tests are plain C and built without any architecture specific code.
|
||||
#
|
||||
|
||||
MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
|
||||
|
||||
# Set search path for all sources
|
||||
VPATH += $(MULTIARCH_SRC)
|
||||
MULTIARCH_SRCS =$(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
|
||||
MULTIARCH_TESTS =$(MULTIARCH_SRCS:.c=)
|
||||
|
||||
# Update TESTS
|
||||
TESTS +=$(MULTIARCH_TESTS)
|
||||
|
||||
#
|
||||
# The following are any additional rules needed to build things
|
||||
#
|
||||
|
||||
testthread: LDFLAGS+=-lpthread
|
||||
|
||||
# We define the runner for test-mmap after the individual
|
||||
# architectures have defined their supported pages sizes. If no
|
||||
# additional page sizes are defined we only run the default test.
|
||||
|
||||
# default case (host page size)
|
||||
run-test-mmap: test-mmap
|
||||
$(call quiet-command, $(QEMU) $< > test-mmap.out, "TEST", \
|
||||
"$< (default) on $(TARGET_NAME)")
|
||||
|
||||
# additional page sizes (defined by each architecture adding to EXTRA_RUNS)
|
||||
run-test-mmap-%: test-mmap
|
||||
$(call quiet-command, $(QEMU) -p $* $< > test-mmap-$*.out, "TEST", \
|
||||
"$< ($* byte pages) on $(TARGET_NAME)")
|
1
tests/tcg/multiarch/README
Normal file
1
tests/tcg/multiarch/README
Normal file
@ -0,0 +1 @@
|
||||
Multi-architecture linux-user tests
|
@ -1,157 +0,0 @@
|
||||
/* Test path override code */
|
||||
#include "config-host.h"
|
||||
#include "util/cutils.c"
|
||||
#include "util/hexdump.c"
|
||||
#include "util/iov.c"
|
||||
#include "util/path.c"
|
||||
#include "util/qemu-timer-common.c"
|
||||
#include <stdarg.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
void qemu_log(const char *fmt, ...);
|
||||
|
||||
/* Any log message kills the test. */
|
||||
void qemu_log(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf(stderr, "FATAL: ");
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#define NO_CHANGE(_path) \
|
||||
do { \
|
||||
if (strcmp(path(_path), _path) != 0) return __LINE__; \
|
||||
} while(0)
|
||||
|
||||
#define CHANGE_TO(_path, _newpath) \
|
||||
do { \
|
||||
if (strcmp(path(_path), _newpath) != 0) return __LINE__; \
|
||||
} while(0)
|
||||
|
||||
static void cleanup(void)
|
||||
{
|
||||
unlink("/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
unlink("/tmp/qemu-test_path/DIR1/DIR2/FILE2");
|
||||
unlink("/tmp/qemu-test_path/DIR1/DIR2/FILE3");
|
||||
unlink("/tmp/qemu-test_path/DIR1/DIR2/FILE4");
|
||||
unlink("/tmp/qemu-test_path/DIR1/DIR2/FILE5");
|
||||
rmdir("/tmp/qemu-test_path/DIR1/DIR2");
|
||||
rmdir("/tmp/qemu-test_path/DIR1/DIR3");
|
||||
rmdir("/tmp/qemu-test_path/DIR1");
|
||||
rmdir("/tmp/qemu-test_path");
|
||||
}
|
||||
|
||||
static unsigned int do_test(void)
|
||||
{
|
||||
if (mkdir("/tmp/qemu-test_path", 0700) != 0)
|
||||
return __LINE__;
|
||||
|
||||
if (mkdir("/tmp/qemu-test_path/DIR1", 0700) != 0)
|
||||
return __LINE__;
|
||||
|
||||
if (mkdir("/tmp/qemu-test_path/DIR1/DIR2", 0700) != 0)
|
||||
return __LINE__;
|
||||
|
||||
if (mkdir("/tmp/qemu-test_path/DIR1/DIR3", 0700) != 0)
|
||||
return __LINE__;
|
||||
|
||||
if (close(creat("/tmp/qemu-test_path/DIR1/DIR2/FILE", 0600)) != 0)
|
||||
return __LINE__;
|
||||
|
||||
if (close(creat("/tmp/qemu-test_path/DIR1/DIR2/FILE2", 0600)) != 0)
|
||||
return __LINE__;
|
||||
|
||||
if (close(creat("/tmp/qemu-test_path/DIR1/DIR2/FILE3", 0600)) != 0)
|
||||
return __LINE__;
|
||||
|
||||
if (close(creat("/tmp/qemu-test_path/DIR1/DIR2/FILE4", 0600)) != 0)
|
||||
return __LINE__;
|
||||
|
||||
if (close(creat("/tmp/qemu-test_path/DIR1/DIR2/FILE5", 0600)) != 0)
|
||||
return __LINE__;
|
||||
|
||||
init_paths("/tmp/qemu-test_path");
|
||||
|
||||
NO_CHANGE("/tmp");
|
||||
NO_CHANGE("/tmp/");
|
||||
NO_CHANGE("/tmp/qemu-test_path");
|
||||
NO_CHANGE("/tmp/qemu-test_path/");
|
||||
NO_CHANGE("/tmp/qemu-test_path/D");
|
||||
NO_CHANGE("/tmp/qemu-test_path/DI");
|
||||
NO_CHANGE("/tmp/qemu-test_path/DIR");
|
||||
NO_CHANGE("/tmp/qemu-test_path/DIR1");
|
||||
NO_CHANGE("/tmp/qemu-test_path/DIR1/");
|
||||
|
||||
NO_CHANGE("/D");
|
||||
NO_CHANGE("/DI");
|
||||
NO_CHANGE("/DIR");
|
||||
NO_CHANGE("/DIR2");
|
||||
NO_CHANGE("/DIR1.");
|
||||
|
||||
CHANGE_TO("/DIR1", "/tmp/qemu-test_path/DIR1");
|
||||
CHANGE_TO("/DIR1/", "/tmp/qemu-test_path/DIR1");
|
||||
|
||||
NO_CHANGE("/DIR1/D");
|
||||
NO_CHANGE("/DIR1/DI");
|
||||
NO_CHANGE("/DIR1/DIR");
|
||||
NO_CHANGE("/DIR1/DIR1");
|
||||
|
||||
CHANGE_TO("/DIR1/DIR2", "/tmp/qemu-test_path/DIR1/DIR2");
|
||||
CHANGE_TO("/DIR1/DIR2/", "/tmp/qemu-test_path/DIR1/DIR2");
|
||||
|
||||
CHANGE_TO("/DIR1/DIR3", "/tmp/qemu-test_path/DIR1/DIR3");
|
||||
CHANGE_TO("/DIR1/DIR3/", "/tmp/qemu-test_path/DIR1/DIR3");
|
||||
|
||||
NO_CHANGE("/DIR1/DIR2/F");
|
||||
NO_CHANGE("/DIR1/DIR2/FI");
|
||||
NO_CHANGE("/DIR1/DIR2/FIL");
|
||||
NO_CHANGE("/DIR1/DIR2/FIL.");
|
||||
|
||||
CHANGE_TO("/DIR1/DIR2/FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
CHANGE_TO("/DIR1/DIR2/FILE2", "/tmp/qemu-test_path/DIR1/DIR2/FILE2");
|
||||
CHANGE_TO("/DIR1/DIR2/FILE3", "/tmp/qemu-test_path/DIR1/DIR2/FILE3");
|
||||
CHANGE_TO("/DIR1/DIR2/FILE4", "/tmp/qemu-test_path/DIR1/DIR2/FILE4");
|
||||
CHANGE_TO("/DIR1/DIR2/FILE5", "/tmp/qemu-test_path/DIR1/DIR2/FILE5");
|
||||
|
||||
NO_CHANGE("/DIR1/DIR2/FILE6");
|
||||
NO_CHANGE("/DIR1/DIR2/FILE/X");
|
||||
|
||||
CHANGE_TO("/DIR1/../DIR1", "/tmp/qemu-test_path/DIR1");
|
||||
CHANGE_TO("/DIR1/../DIR1/", "/tmp/qemu-test_path/DIR1");
|
||||
CHANGE_TO("/../DIR1", "/tmp/qemu-test_path/DIR1");
|
||||
CHANGE_TO("/../DIR1/", "/tmp/qemu-test_path/DIR1");
|
||||
CHANGE_TO("/DIR1/DIR2/../DIR2", "/tmp/qemu-test_path/DIR1/DIR2");
|
||||
CHANGE_TO("/DIR1/DIR2/../DIR2/../../DIR1/DIR2/FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
CHANGE_TO("/DIR1/DIR2/../DIR2/FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
|
||||
NO_CHANGE("/DIR1/DIR2/../DIR1");
|
||||
NO_CHANGE("/DIR1/DIR2/../FILE");
|
||||
|
||||
CHANGE_TO("/./DIR1/DIR2/FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
CHANGE_TO("/././DIR1/DIR2/FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
CHANGE_TO("/DIR1/./DIR2/FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
CHANGE_TO("/DIR1/././DIR2/FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
CHANGE_TO("/DIR1/DIR2/./FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
CHANGE_TO("/DIR1/DIR2/././FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
CHANGE_TO("/./DIR1/./DIR2/./FILE", "/tmp/qemu-test_path/DIR1/DIR2/FILE");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = do_test();
|
||||
cleanup();
|
||||
if (ret) {
|
||||
fprintf(stderr, "test_path: failed on line %i\n", ret);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user