Re: [PATCH v2] [TCK] Convert scripts to also run with dash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/15/2010 06:49 PM, Eric Blake wrote:
On 11/15/2010 12:40 PM, Stefan Berger wrote:
v2:
     - following Eric's suggestions from review of v1
     - runs with ksh shell as well

-          [ $((flags&  FLAG_LIBVIRT_TEST)) -ne 0 ]&&  \
-              test_result $((passctr+failctr)) "" 1
-          [ $((flags&  FLAG_TAP_TEST)) -ne 0 ]&&  \
-             tap_fail $((passctr+failctr)) "${xmlfile} : ${cmd}"
+          [ $(($flags&  $FLAG_LIBVIRT_TEST)) -ne 0 ]&&  \
+            test_result $(($passctr + $failctr)) "" 1
+          [ $(($flags&  FLAG_TAP_TEST)) -ne 0 ]&&  \


@@ -486,34 +486,32 @@ function deleteTestFilter() {
  }


-function main() {
-  local prgname="$0"
-  local vm1 vm2
-  local xmldir="nwfilterxml2xmlin"
-  local fwalldir="nwfilterxml2fwallout"
-  local found=0 vms res
-  local filtername="tck-testcase"
-  local libvirtdpid=-1
-  local flags OPWD
+main() {
+  prgname="$0"
Using $0 fails inside of some zsh versions (where it used to name the
function, rather than being global to the shell script); but that's
probably irrelevant to this exercise (I don't know of any Linux versions
that use zsh as /bin/sh, although it has happened on some BSD variants;
and modern zsh has fixed that bug).  At any rate, if it bothers you, the
workaround is to copy $0 to a global variable at the beginning of the
script, rather than assigning prgname inside of every function that
cares about the global state of $0.

At any rate, given your testing with dash and ksh, and the minor nature
of my nits, feel free to push one you've fixed those without needing to
send a v3.

ACK.

I pushed this now with above nits addressed, but not that one about zsh. I trust user will have a fixed zsh...

   Stefan

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]