|
From: <sv...@va...> - 2016-01-20 23:15:11
|
Author: mjw
Date: Wed Jan 20 23:15:04 2016
New Revision: 15765
Log:
Use command -v instead of which in res_search.vgtest prereq.
"command -v" is a (POSIX) shell builtin that should work everywhere.
"which" might be an external command that might not be installed in
which case the shell might just error out.
Modified:
trunk/none/tests/res_search.vgtest
Modified: trunk/none/tests/res_search.vgtest
==============================================================================
--- trunk/none/tests/res_search.vgtest (original)
+++ trunk/none/tests/res_search.vgtest Wed Jan 20 23:15:04 2016
@@ -1,4 +1,4 @@
-prereq: which host >/dev/null 2>/dev/null && host www.yahoo.com > /dev/null && ! ../../tests/os_test darwin
+prereq: command -v host >/dev/null 2>/dev/null && host www.yahoo.com > /dev/null && ! ../../tests/os_test darwin
prog: res_search
args: www.yahoo.com
vgopts: -q
|
|
From: Petar J. <mip...@gm...> - 2016-02-03 19:52:12
|
Hi Mark, On Thu, Jan 21, 2016 at 12:15 AM, <sv...@va...> wrote: > Author: mjw > Date: Wed Jan 20 23:15:04 2016 > New Revision: 15765 > > Log: > Use command -v instead of which in res_search.vgtest prereq. > > "command -v" is a (POSIX) shell builtin that should work everywhere. > "which" might be an external command that might not be installed in > which case the shell might just error out. > This will not work on systems that do not have 'host' installed, as vg_regtest script uses '/bin/sh -c' to execute the command, so it will return error code 127 and stop the testing. E.g. if I rename "host" to "host123" and try it out: $ /bin/sh -c which host123 && host123 $ echo $? 1 $ /bin/sh -c command -v host123 && host123 host123: command not found $ echo $? 127 Regards, Petar > Modified: > trunk/none/tests/res_search.vgtest > > Modified: trunk/none/tests/res_search.vgtest > > ============================================================================== > --- trunk/none/tests/res_search.vgtest (original) > +++ trunk/none/tests/res_search.vgtest Wed Jan 20 23:15:04 2016 > @@ -1,4 +1,4 @@ > -prereq: which host >/dev/null 2>/dev/null && host www.yahoo.com > > /dev/null && ! ../../tests/os_test darwin > +prereq: command -v host >/dev/null 2>/dev/null && host www.yahoo.com > > /dev/null && ! ../../tests/os_test darwin > prog: res_search > args: www.yahoo.com > vgopts: -q > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > |
|
From: Mark W. <mj...@re...> - 2016-02-03 20:49:18
|
On Wed, 2016-02-03 at 20:52 +0100, Petar Jovanovic wrote: > On Thu, Jan 21, 2016 at 12:15 AM, <sv...@va...> wrote: > > "command -v" is a (POSIX) shell builtin that should work everywhere. > > "which" might be an external command that might not be installed in > > which case the shell might just error out. > > > This will not work on systems that do not have 'host' installed, as > vg_regtest script uses '/bin/sh -c' to execute the command, so it will > return error code 127 and stop the testing. E.g. if I rename "host" to > "host123" and try it out: > > $ /bin/sh -c which host123 && host123 > $ echo $? > 1 > $ /bin/sh -c command -v host123 && host123 > host123: command not found > $ echo $? > 127 O, that is annoying. Sorry about that. So we don't want to use which because that is an external command that might not be installed (which is how I found out) and we also want to explicitly test that the host command actually is installed and that it can resolve the given hostname (in case the build is running on a networkless host). Would the following work? prereq: test $(command -v host) && host www.yahoo.com > /dev/null It assumes test is always available, but I hope it is. |
|
From: Petar J. <mip...@gm...> - 2016-02-03 22:32:15
|
On Wed, Feb 3, 2016 at 9:49 PM, Mark Wielaard <mj...@re...> wrote: > On Wed, 2016-02-03 at 20:52 +0100, Petar Jovanovic wrote: > > On Thu, Jan 21, 2016 at 12:15 AM, <sv...@va...> wrote: > > > "command -v" is a (POSIX) shell builtin that should work everywhere. > > > "which" might be an external command that might not be installed in > > > which case the shell might just error out. > > > > > This will not work on systems that do not have 'host' installed, as > > vg_regtest script uses '/bin/sh -c' to execute the command, so it will > > return error code 127 and stop the testing. E.g. if I rename "host" to > > "host123" and try it out: > > > > $ /bin/sh -c which host123 && host123 > > $ echo $? > > 1 > > $ /bin/sh -c command -v host123 && host123 > > host123: command not found > > $ echo $? > > 127 > > O, that is annoying. Sorry about that. > So we don't want to use which because that is an external command that > might not be installed (which is how I found out) and we also want to > explicitly test that the host command actually is installed and that it > can resolve the given hostname (in case the build is running on a > networkless host). > > Would the following work? > > prereq: test $(command -v host) && host www.yahoo.com > /dev/null > > It assumes test is always available, but I hope it is. > Yes, I believe that will work. Regards, Petar |