* [question kvm-unit-tests] issue about exec
@ 2016-03-28 11:11 Zhu Yijun
2016-03-29 12:03 ` Andrew Jones
0 siblings, 1 reply; 5+ messages in thread
From: Zhu Yijun @ 2016-03-28 11:11 UTC (permalink / raw)
To: kvm; +Cc: oscar.zhangbo, Hangaohuai
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.
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}<&-
}
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [question kvm-unit-tests] issue about exec
2016-03-28 11:11 [question kvm-unit-tests] issue about exec Zhu Yijun
@ 2016-03-29 12:03 ` Andrew Jones
2016-03-29 13:43 ` Paolo Bonzini
2016-03-30 2:26 ` Zhu Yijun
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Jones @ 2016-03-29 12:03 UTC (permalink / raw)
To: Zhu Yijun; +Cc: kvm, oscar.zhangbo, Hangaohuai
On Mon, Mar 28, 2016 at 07:11:41PM +0800, Zhu Yijun wrote:
> 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.
Hmm, I didn't know there were bash versions w/out exec. Is your bash
really bash?
>
> 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}<&-
> }
>
>
> 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.
Is there something unusual about your file system? Is the disk it's
accessing remote? Anyway, I agree this is all weird. Unfortunately I
don't have any suggestions.
Thanks,
drew
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [question kvm-unit-tests] issue about exec
2016-03-29 12:03 ` Andrew Jones
@ 2016-03-29 13:43 ` Paolo Bonzini
2016-03-30 2:54 ` Zhu Yijun
2016-03-30 2:26 ` Zhu Yijun
1 sibling, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2016-03-29 13:43 UTC (permalink / raw)
To: Andrew Jones, Zhu Yijun; +Cc: kvm, oscar.zhangbo, Hangaohuai
On 29/03/2016 14:03, Andrew Jones wrote:
>> > 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.
> Hmm, I didn't know there were bash versions w/out exec. Is your bash
> really bash?
It could be the "{fd}<foo" feature, which according to
http://tiswww.case.edu/php/chet/bash/NEWS was introduced in 4.1:
----
This is a terse description of the new features added to bash-4.1 since
the release of bash-4.0.
[...]
p. If the optional left-hand-side of a redirection is of the form
{var}, the shell assigns the file descriptor used to $var or uses $var
as the file descriptor to move or close, depending on the redirection
operator.
----
Yijun, I think using "10" unconditionally would work (i.e. replace {fd}
and $fd with 10).
Paolo
>> >
>> > 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"
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [question kvm-unit-tests] issue about exec
2016-03-29 13:43 ` Paolo Bonzini
@ 2016-03-30 2:54 ` Zhu Yijun
0 siblings, 0 replies; 5+ messages in thread
From: Zhu Yijun @ 2016-03-30 2:54 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Andrew Jones, kvm, oscar.zhangbo, Hangaohuai
On 2016/3/29 21:43, Paolo Bonzini wrote:
>
>
> On 29/03/2016 14:03, Andrew Jones wrote:
>>>> 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.
>> Hmm, I didn't know there were bash versions w/out exec. Is your bash
>> really bash?
>
> It could be the "{fd}<foo" feature, which according to
> http://tiswww.case.edu/php/chet/bash/NEWS was introduced in 4.1:
>
> ----
> This is a terse description of the new features added to bash-4.1 since
> the release of bash-4.0.
>
> [...]
>
> p. If the optional left-hand-side of a redirection is of the form
> {var}, the shell assigns the file descriptor used to $var or uses $var
> as the file descriptor to move or close, depending on the redirection
> operator.
> ----
>
> Yijun, I think using "10" unconditionally would work (i.e. replace {fd}
> and $fd with 10).
>
Yes, it works. Thanks very much!
> Paolo
>
>>>>
>>>> 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"
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [question kvm-unit-tests] issue about exec
2016-03-29 12:03 ` Andrew Jones
2016-03-29 13:43 ` Paolo Bonzini
@ 2016-03-30 2:26 ` Zhu Yijun
1 sibling, 0 replies; 5+ messages in thread
From: Zhu Yijun @ 2016-03-30 2:26 UTC (permalink / raw)
To: Andrew Jones; +Cc: kvm, oscar.zhangbo, Hangaohuai
Hi Andrew,
Thanks for your reply.
On 2016/3/29 20:03, Andrew Jones wrote:
> On Mon, Mar 28, 2016 at 07:11:41PM +0800, Zhu Yijun wrote:
>> 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.
>
> Hmm, I didn't know there were bash versions w/out exec. Is your bash
> really bash?
>
>>
>> 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}<&-
>> }
>>
>>
>> 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.
>
> Is there something unusual about your file system? Is the disk it's
> accessing remote? Anyway, I agree this is all weird. Unfortunately I
> don't have any suggestions.
>
I found that the parameter "-serial stdio" in the command line(qemu-kvm -enable-kvm -device pc-testdev ... -serial stdio ...) eats the first character 'f'.
Using "-serial file:/PATH/test.log" will resolve it. However, I still cannot understand the really reason.
> Thanks,
> drew
> --
> 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
>
> .
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-30 2:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-28 11:11 [question kvm-unit-tests] issue about exec Zhu Yijun
2016-03-29 12:03 ` Andrew Jones
2016-03-29 13:43 ` Paolo Bonzini
2016-03-30 2:54 ` Zhu Yijun
2016-03-30 2:26 ` Zhu Yijun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).