Browse Source
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>pull/73/head
10 changed files with 45 additions and 194 deletions
@ -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)") |
|||
@ -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