From: Christian Goeschel Ndjomouo Date: Mon, 6 Apr 2026 21:42:17 +0000 (-0400) Subject: tests: (bits) add --width tests for invalid values X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7f870e6df5f024ae96a8396dd556aa78a85a1606;p=thirdparty%2Futil-linux.git tests: (bits) add --width tests for invalid values Signed-off-by: Christian Goeschel Ndjomouo --- diff --git a/tests/expected/bits/bits-width-greater-128KB.err b/tests/expected/bits/bits-width-greater-128KB.err new file mode 100644 index 000000000..254313fca --- /dev/null +++ b/tests/expected/bits/bits-width-greater-128KB.err @@ -0,0 +1 @@ +bits: invalid --width: '132096': ERANGE diff --git a/tests/expected/bits/bits-width-zero.err b/tests/expected/bits/bits-width-zero.err new file mode 100644 index 000000000..59ae6349f --- /dev/null +++ b/tests/expected/bits/bits-width-zero.err @@ -0,0 +1 @@ +bits: invalid --width diff --git a/tests/helpers/test_strerror.c b/tests/helpers/test_strerror.c index a574c6ef3..322ce659b 100644 --- a/tests/helpers/test_strerror.c +++ b/tests/helpers/test_strerror.c @@ -21,6 +21,7 @@ static struct { E(ENOTTY), E(EILSEQ), E(EINVAL), + E(ERANGE), }; int main(int argc, const char *argv[]) @@ -42,3 +43,4 @@ int main(int argc, const char *argv[]) fprintf(stderr, "Invalid errno: %s\n", argv[1]); return -1; } + diff --git a/tests/ts/bits/bits b/tests/ts/bits/bits index 57db84c68..167d968f0 100755 --- a/tests/ts/bits/bits +++ b/tests/ts/bits/bits @@ -44,11 +44,20 @@ $TS_CMD_BITS -l 1,10000 >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "width" -$TS_CMD_BITS -w 16384 -l 10000 >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_BITS --width 16384 -l 10000 >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "width-truncate" -$TS_CMD_BITS -w 32 -l 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_BITS --width 32 -l 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "width-zero" +$TS_CMD_BITS --width 0 -l 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "width-greater-128KB" +$TS_CMD_BITS --width $(( 129 * 1024 )) -l 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG +sed -i -e "s@$($TS_HELPER_STRERROR ERANGE)@ERANGE@" $TS_OUTPUT $TS_ERRLOG ts_finalize_subtest ts_init_subtest "parse-mask"