Message ID | 20180615163139.44159-1-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Rejected, archived |
Headers | show |
On Fri, Jun 15, 2018 at 06:31:39PM +0200, Luc Van Oostenryck wrote: > The busybox version of timeout(1) requires that the duration > is given via a '-t' option. > > However, the GNU coreutils' version has no such option and simply > take the duration as its first argument. > > Fix the test-suite script to detect which version is used and pass > the duration accordingly. > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Rather than detecting the version, how about looking at `timeout --help` for '-t\>' or '-k\>' ? (Or, for that matter, teaching busybox to know better. At some point, especially for commands unspecified by POSIX, I think it'd make sense to just treat deficiencies as bugs.) -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Jun 15, 2018 at 11:53:14AM -0700, Josh Triplett wrote: > On Fri, Jun 15, 2018 at 06:31:39PM +0200, Luc Van Oostenryck wrote: > > The busybox version of timeout(1) requires that the duration > > is given via a '-t' option. > > > > However, the GNU coreutils' version has no such option and simply > > take the duration as its first argument. > > > > Fix the test-suite script to detect which version is used and pass > > the duration accordingly. > > > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> > > Rather than detecting the version, how about looking at `timeout --help` > for '-t\>' or '-k\>' ? Yes, that would be better (however, IIRC, the support for --help in busybox is optional). > (Or, for that matter, teaching busybox to know better. At some point, > especially for commands unspecified by POSIX, I think it'd make sense to > just treat deficiencies as bugs.) Yes, I agree, however: * I doubt such a change would be accepted because it would be an incompatible changes for the users of busybox's timeout(1) * even if accepted, it would take much time to be in a release and then present in distros (but maybe Alpine has a relatively short cycle? I dunno). The whole thing annoys me a little bit and I'm wondering if it wouldn't be better to not use the timeout command and cook something in pure POSIX shell instead. -- Luc -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" 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/validation/test-suite b/validation/test-suite index e1ab1e657..e5939cdde 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -9,6 +9,7 @@ default_cmd="sparse \$file" default_args="$SPARSE_TEST_ARGS" tests_list="" prog_name=`basename $0` +timeout_args="" if [ ! -x "$default_path/sparse-llvm" ]; then disabled_cmds="sparsec sparsei sparse-llvm sparse-llvm-dis" @@ -341,7 +342,14 @@ do_test() # do we want a timeout? pre_cmd="" if [ $check_timeout -ne 0 ]; then - pre_cmd="timeout -k 1s $check_timeout" + if [ -z "$timeout_args" ]; then + if timeout --version 2>&1 | grep -q BusyBox; then + timeout_args="-t" + else + timeout_args="-k 1s" + fi + fi + pre_cmd="timeout $timeout_args $check_timeout" fi shift
The busybox version of timeout(1) requires that the duration is given via a '-t' option. However, the GNU coreutils' version has no such option and simply take the duration as its first argument. Fix the test-suite script to detect which version is used and pass the duration accordingly. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- validation/test-suite | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)