From patchwork Thu Apr 19 13:58:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 133796 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp703998ljf; Thu, 19 Apr 2018 07:28:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqlFQhoAik2RIRSpeS0KQ31eb5i9sil1RehSy1d9FR7JnOZs7cyqp5OU0eOhVBrkBwJmd4X X-Received: by 10.55.139.7 with SMTP id n7mr6129159qkd.210.1524148139466; Thu, 19 Apr 2018 07:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524148139; cv=none; d=google.com; s=arc-20160816; b=xY0/4s1gPyPdEVUM1P72DqN5kQtylJrkL2p4EGK5c5ncg3Y596UYEfLom1AEfYgIwP EkMGU+P5jm3V+zQMh08ciYzytd2OgZdZ6GUHi9QtSAE5Ajio5Hhsq33/XWCfhEVRqtkB kKV6fZDzWKihLxb7eDwCyx0IYrCKBIrjO//bhY/lZWUUtawEDTfNYDgAPzzPBwCoTY2A 9Cz6WsjVAasXvYpcjHTmLIxANUc+GUBbN4MR9xAjLZPElQ6pfpsCdx17a8qKdLzbWncE jqshjeI6CgRVAjg7TwANSecIdWzbVhdLJDkMoHeTROkmhMcVVt8tFSrri6VBzijT9+cS 6giA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=vUO1+oC4MRsaR4YCV5AlhtkzJ+Q5g7rrTuNL8mCWqY8=; b=hmlNo7QDcHeIq+ScWN7y1u/EVan9KntmvfkHHpx9g/CpJsFQRLX8xUwmNCfn4Meiyr NXPF5Ovi3NhXHF7MNT7vBIa4ALI/q/Ru1gOAtfCTAYDF0hvyx3lu3xVmMBmHrX7Mz9wa 16O6xEVpOqpJAX8RlVSnOCVw9ZvZtAeeFoe6c3ghu7ntF5oKBUEyMEC37uBXwo2W4nK9 SF+x3jCi/rv4gLqKW2dnExDSHz9j6fruhdtl7KxRQz9VILAekObCfC0a/SbfieVMM+lD 8ASaOhaNefTQUwq5LLr+TTImUa/2V0FxR052sUSZE9m+nU0IAyJZt8RM8mHBGAqUqD+b AhBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KZ2Yc1QE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j186si4537652qkd.386.2018.04.19.07.28.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 19 Apr 2018 07:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KZ2Yc1QE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9AYU-0000y2-Qd for patch@linaro.org; Thu, 19 Apr 2018 10:28:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9ANO-0004eV-9m for qemu-devel@nongnu.org; Thu, 19 Apr 2018 10:17:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9ANM-00063v-9d for qemu-devel@nongnu.org; Thu, 19 Apr 2018 10:17:30 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:40171) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f9ANL-00063Z-VW for qemu-devel@nongnu.org; Thu, 19 Apr 2018 10:17:28 -0400 Received: by mail-wr0-x241.google.com with SMTP id v60-v6so14510343wrc.7 for ; Thu, 19 Apr 2018 07:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vUO1+oC4MRsaR4YCV5AlhtkzJ+Q5g7rrTuNL8mCWqY8=; b=KZ2Yc1QEO3hGL+Kaz1sUnz7ZHzyR0UWfCDGWx3mMrD0XPqbl6n32v9IkI9Bvlv2y0L rZXqJxpaGZ5ZV47IlmR2/811KHLGdPHI0WM1irutptV4Rc8XXQJIr8JkZmw5NfwceSpC b+SB8BGoQQPs+9lGwEJWWHCUEF8OjnEIFqj+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vUO1+oC4MRsaR4YCV5AlhtkzJ+Q5g7rrTuNL8mCWqY8=; b=SqgiLtaELPekZNjSZT42R6q2wEsk6jCme7kXTJZS1pv8Ah6d6K4lSRrOcyNdYY16j/ URv+HADD3XGtEWvacGcdH+uBPLEDaF8l+Nh05LN7Eaigu+T0PSBNdlglIhGGVYnpkjl9 AXMe2/DKESghAWiqtZ/fOemO4Hwye9hL366T3E7kqg+sjEhpd0Cy+Mx4kACLqU1FqSvo 4c79fm1c2IgCvpWiYH3PbK3Srb1xijNXY+Iksv9F3t2zNHZpG+9IqO443qrTUBzn2+TQ SiurCbcI71CIWOlOzknrHeZRXO9hRZewZD6hlp4ENf3LTMaMzB4yADkx0Re/4/bMvmsl vbrg== X-Gm-Message-State: ALQs6tB82OHtQ999wxt6x/lzJACoFgxoKPQh/4sfXAsCdmxUi0tkvUId i97t4PD2llIWzDb51HH8bw2nNA== X-Received: by 10.28.217.67 with SMTP id q64mr4893156wmg.12.1524147446679; Thu, 19 Apr 2018 07:17:26 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id e50-v6sm5259151wre.4.2018.04.19.07.17.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 07:17:25 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 707633E041B; Thu, 19 Apr 2018 14:59:02 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, cota@braap.org, famz@redhat.com, berrange@redhat.com, f4bug@amsat.org, richard.henderson@linaro.org, balrogg@gmail.com, aurelien@aurel32.net, agraf@suse.de Date: Thu, 19 Apr 2018 14:58:30 +0100 Message-Id: <20180419135901.30035-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180419135901.30035-1-alex.bennee@linaro.org> References: <20180419135901.30035-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PATCH v2 12/43] tests/tcg: move architecture independent tests into subdir X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Thomas Huth --- v2 - move VPATH and TESTs setup into multiarch/Makefile.target - remove moved bits from tests/tcg/Makefile --- tests/tcg/Makefile | 31 ----- tests/tcg/README | 10 +- tests/tcg/multiarch/Makefile.target | 30 +++++ tests/tcg/multiarch/README | 1 + tests/tcg/{ => multiarch}/linux-test.c | 0 tests/tcg/{ => multiarch}/sha1.c | 0 tests/tcg/{ => multiarch}/test-mmap.c | 0 tests/tcg/{ => multiarch}/testthread.c | 0 tests/tcg/test_path.c | 157 ------------------------- 9 files changed, 35 insertions(+), 194 deletions(-) create mode 100644 tests/tcg/multiarch/Makefile.target create mode 100644 tests/tcg/multiarch/README rename tests/tcg/{ => multiarch}/linux-test.c (100%) rename tests/tcg/{ => multiarch}/sha1.c (100%) rename tests/tcg/{ => multiarch}/test-mmap.c (100%) rename tests/tcg/{ => multiarch}/testthread.c (100%) delete mode 100644 tests/tcg/test_path.c -- 2.17.0 Reviewed-by: Richard Henderson diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile index 89e3342f3d..e12395117a 100644 --- a/tests/tcg/Makefile +++ b/tests/tcg/Makefile @@ -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 $@ $( -#include -#include - -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; -}