From patchwork Mon Mar 28 11:11:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yijun X-Patchwork-Id: 8678981 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F3C78C0553 for ; Mon, 28 Mar 2016 11:12:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21BA0200E1 for ; Mon, 28 Mar 2016 11:12:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7CC052012D for ; Mon, 28 Mar 2016 11:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753570AbcC1LMf (ORCPT ); Mon, 28 Mar 2016 07:12:35 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:14365 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751813AbcC1LMe (ORCPT ); Mon, 28 Mar 2016 07:12:34 -0400 Received: from 172.24.1.49 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.49]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BYU94743; Mon, 28 Mar 2016 19:12:19 +0800 (CST) Received: from [127.0.0.1] (10.177.27.25) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Mon, 28 Mar 2016 19:12:08 +0800 Message-ID: <56F9116D.5080407@huawei.com> Date: Mon, 28 Mar 2016 19:11:41 +0800 From: Zhu Yijun User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: CC: , Hangaohuai Subject: [question kvm-unit-tests] issue about exec X-Originating-IP: [10.177.27.25] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.56F91194.00B0, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9b77cf9ef56d692205361f1e32618fab Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all, I am running kvm-unit-tests, the Bash(version is low) on my server doesn't support the command 'exec', so I changed some codes in kvm-unit-tests. Then, the even unit test will not be executed because the "file" field of unittests.cfg not parsed correctly. Debug info showed as follow: zyj # Define your new unittest following the convention: zyj # [unittest_name] zyj # file = foo.flat # Name of the flat file to be used zyj # smp = 2 # Number of processors the VM will use during this test zyj # # Use $MAX_SMP to use the maximum the host supports. zyj # extra_params = -cpu qemu64,+x2apic # Additional parameters used zyj # arch = i386/x86_64 # Only if the test case works only on one of them zyj # groups = group1 group2 # Used to identify test cases with run_tests -g ... zyj zyj [apic] zyj file = apic.flat zyj smp = 2 zyj extra_params = -cpu qemu64,+x2apic,+tsc-deadline zyj arch = x86_64 zyj zyj [ioapic] FAIL apic zyj ile = ioapic.flat # It got a WRONG LINE here, which should be 'file = **' , but we missed the first character 'f'.... zyj extra_params = -cpu qemu64 zyj arch = x86_64 zyj zyj [smptest] qemu-kvm: -kernel -smp: could not open disk image 1: Could not open file: No such file or directory PASS ioapic zyj file = smptest.flat #The read LINE becomes correct after the WRONG one. zyj smp = 2 zyj zyj [smptest3] PASS smptest zyj ile = smptest.flat #The LINE becomes incorrect again.. zyj smp = 3 zyj zyj [vmexit_cpuid] I am really confused about this, so is it the right way to read the lines if we have no 'exec' in my bash? and it there any other method to overcome it? thanks in advance. Zhu Yijun --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/functions.bash b/scripts/functions.bash index f13fe6f..241ae0e 100644 --- a/scripts/functions.bash +++ b/scripts/functions.bash @@ -12,9 +12,10 @@ function for_each_unittest() local check local accel - exec {fd}<"$unittests" + #exec {fd}<"$unittests" - while read -u $fd line; do + #while read -u $fd line; do + while read line; do if [[ "$line" =~ ^\[(.*)\]$ ]]; then "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" testname=${BASH_REMATCH[1]} @@ -40,7 +41,7 @@ function for_each_unittest() elif [[ $line =~ ^accel\ *=\ *(.*)$ ]]; then accel=${BASH_REMATCH[1]} fi - done + done < $unittests "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" - exec {fd}<&- + #exec {fd}<&- }