From patchwork Tue Apr 24 15:23:33 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: 134149 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2448018lji; Tue, 24 Apr 2018 09:33:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZptpGOlZIlRi3ewmjvJOeu28A64MQTAqD81c/J9ZIHglyg4+EFKDM5EOBI40VM9kHlu1Bya X-Received: by 2002:aed:32e3:: with SMTP id z90-v6mr28415551qtd.14.1524587635275; Tue, 24 Apr 2018 09:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524587635; cv=none; d=google.com; s=arc-20160816; b=jThTUsqK21yo6wZLzUYBmZ+t+HLErjeZXgUQMX9NvJl6PzPNiVEEKd6kt0nf5Hp3H2 ceW+m3Bxp+wf8ACj72kZdtUfmGAEnisCv98d+6yU36zLwg/1pKZUzrk66CwzJNOaIuso cf1L2irtLluBl2xNgLDk/nG1gkGaxsqHPbiW20r6wLV/5ZygYEyn7a+OGLvPgHJnQ374 1GoBw3YjZMDPUpp2YMABc4gyA7nj/xOEq53dlKfbkrRqHFJ5mDt11Oy6xhfdG1QkkYh2 dP1Fjx2TZ9SkZGhUoEho6JOlWWPDAIP8yH21AV+Hjjd2g7Rizuty1yze6LwbYhhRe77P MSEQ== 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=0aEv/T7VO8p/Ly6Z9P9EtV6cAUHTxvtbxIVuXNfrrMc=; b=w0vGvaK+lklm65HUSr94HuAmI6qcBmPEY2NfpJEqPCYOPRnXwaDiiEPQN7hlUK8OPn uG4Cxf4uF2d2Kf+rPEbDyB4m4g1QwtEkn5tZOgzSkUA+MJtSw2m00hkG1Ts6+Gk718K8 7Pqtm3q4wu6GOEl71H0m8Lc7o2ElF8S7Sed3p5XlMO1eT5xKpxMnyDcV/Zlq2zclLsU8 wR+iNZJC4MeBechLg2CGsBk7mGtrM3yNoufvpWKtzTvW/wvvasISYev61O0+LtxLN9eW J0/W5YmhD8CDIt9oM0Ft+FgcPxMCkGEEhYbfidO4zPsODdeH/Yqcf56GGzYlZG3D7Wpf jZhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aBPpzt/c; 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 f31si2587804qve.185.2018.04.24.09.33.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 Apr 2018 09:33:55 -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=aBPpzt/c; 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]:59556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fB0t8-0003fF-Oa for patch@linaro.org; Tue, 24 Apr 2018 12:33:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAzwf-000671-Kw for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:33:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAzwd-0001kz-VH for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:33:29 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33392) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fAzwd-0001jw-MO for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:33:27 -0400 Received: by mail-wr0-x241.google.com with SMTP id o4-v6so141639wrm.0 for ; Tue, 24 Apr 2018 08:33: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=0aEv/T7VO8p/Ly6Z9P9EtV6cAUHTxvtbxIVuXNfrrMc=; b=aBPpzt/c9vpzlVSV+QpnNhqn0WcCOJ2ev8xgIPekym76YHtZD2vSzx6ng4qekdqUPN LwLBAEpZBSmfitAVMkD1lErGoh6YWa7Mxo8JhvScgZcv1NiCdIeEKKVf61dl7xIDD427 Hha+YFIX0csx7Dch9FpiwNWTMFvpSDvewfuik= 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=0aEv/T7VO8p/Ly6Z9P9EtV6cAUHTxvtbxIVuXNfrrMc=; b=ZU1JmezY4L0nDXd7DsmAJPL9k5U3ljTyVgorioura7SQNLPpWP2UIz2Tvh0byGD6YN G9DYjG8daagK4yiCLcex8gCIbFbZe6LvEkBTZwjvleHi7ftkbBxhc7SW0AqzokjX0GSq wP7dELe/Co/Cd5BxJnD9pUo6gEuw+cDeaDqrPMekI/rOl4OoVF5NyuOplAcYVEDFr1BJ y0wcfZJOxAxL+37KS5IKtQx43nN/pwvb9vOXY+4NLVbhjJjS06FU/1pa49uVzmykHRDr YL8m+AceiZXDnYUUd6owmBpDfp55QKysKYWAFbocfxhCS6u/S42i3bK2H9yF95fB1Plx C7vQ== X-Gm-Message-State: ALQs6tAhhfCvSc3l+4Un/ANlLL5V3QBIc3bwZybTU337Nv7KoWbeHKDV cPHE77BT8CykMkbEQ3Ad6BZIoQ== X-Received: by 2002:adf:9cc5:: with SMTP id h5-v6mr20164884wre.11.1524584006567; Tue, 24 Apr 2018 08:33:26 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id d28sm18243926wmh.29.2018.04.24.08.33.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 08:33:20 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 785D43E0A8A; Tue, 24 Apr 2018 16:24:06 +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: Tue, 24 Apr 2018 16:23:33 +0100 Message-Id: <20180424152405.10304-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180424152405.10304-1-alex.bennee@linaro.org> References: <20180424152405.10304-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 v3 14/46] tests/tcg/multiarch: enable additional linux-test tests 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" Un-comment the remaining tests. I removed the itimer value tests because I'm fairly sure a re-arming timer will always have a different value in it when you grab it. I've also fixed up the clone thread flags as QEMU will only allow a clone to use flags which match glibc. Signed-off-by: Alex Bennée --- v3 - make clone flags match CLONE_THREAD_FLAGS --- tests/tcg/multiarch/linux-test.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) -- 2.17.0 Reviewed-by: Richard Henderson Tested-by: Philippe Mathieu-Daudé diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c index 4457bd04ba..754edf9910 100644 --- a/tests/tcg/multiarch/linux-test.c +++ b/tests/tcg/multiarch/linux-test.c @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ +#define _GNU_SOURCE #include #include #include @@ -39,6 +40,7 @@ #include #include #include +#include #define TESTPATH "/tmp/linux-test.tmp" #define TESTPORT 7654 @@ -58,8 +60,8 @@ static void error1(const char *filename, int line, const char *fmt, ...) static int __chk_error(const char *filename, int line, int ret) { if (ret < 0) { - error1(filename, line, "%m (ret=%d, errno=%d)", - ret, errno); + error1(filename, line, "%m (ret=%d, errno=%d/%s)", + ret, errno, strerror(errno)); } return ret; } @@ -320,7 +322,6 @@ static void test_socket(void) chk_error(close(server_fd)); } -#if 0 #define WCOUNT_MAX 512 static void test_pipe(void) @@ -355,7 +356,7 @@ static void test_pipe(void) } if (FD_ISSET(fds[1], &wfds)) { ch = 'a'; - chk_error(write(fds[0], &ch, 1)); + chk_error(write(fds[1], &ch, 1)); wcount++; } } @@ -387,6 +388,9 @@ static int thread2_func(void *arg) return 0; } +/* For test_clone we must match the clone flags used by glibc, see + * CLONE_THREAD_FLAGS in the QEMU source code. + */ void test_clone(void) { uint8_t *stack1, *stack2; @@ -394,11 +398,15 @@ void test_clone(void) stack1 = malloc(STACK_SIZE); pid1 = chk_error(clone(thread1_func, stack1 + STACK_SIZE, - CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello1")); + CLONE_VM | CLONE_FS | CLONE_FILES | + CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM, + "hello1")); stack2 = malloc(STACK_SIZE); pid2 = chk_error(clone(thread2_func, stack2 + STACK_SIZE, - CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2")); + CLONE_VM | CLONE_FS | CLONE_FILES | + CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM, + "hello2")); while (waitpid(pid1, &status1, 0) != pid1); free(stack1); @@ -408,7 +416,6 @@ void test_clone(void) thread2_res != 6) error("clone"); } -#endif /***********************************/ @@ -449,12 +456,10 @@ static void test_signal(void) it.it_value.tv_usec = 10 * 1000; chk_error(setitimer(ITIMER_REAL, &it, NULL)); chk_error(getitimer(ITIMER_REAL, &oit)); - if (oit.it_value.tv_sec != it.it_value.tv_sec || - oit.it_value.tv_usec != it.it_value.tv_usec) - error("itimer"); while (alarm_count < 5) { usleep(10 * 1000); + getitimer(ITIMER_REAL, &oit); } it.it_interval.tv_sec = 0; @@ -463,9 +468,6 @@ static void test_signal(void) it.it_value.tv_usec = 0; memset(&oit, 0xff, sizeof(oit)); chk_error(setitimer(ITIMER_REAL, &it, &oit)); - if (oit.it_value.tv_sec != 0 || - oit.it_value.tv_usec != 10 * 1000) - error("setitimer"); /* SIGSEGV test */ act.sa_sigaction = sig_segv; @@ -503,10 +505,11 @@ static void test_shm(void) int main(int argc, char **argv) { test_file(); + test_pipe(); test_fork(); test_time(); test_socket(); - // test_clone(); + test_clone(); test_signal(); test_shm(); return 0;