[PATCH uci 4/6] tests: cram: add uci import testing on fuzzer corpus

Hauke Mehrtens hauke at hauke-m.de
Mon Oct 5 14:21:32 EDT 2020


On 10/5/20 2:03 PM, Petr Štetiar wrote:
> Hauke Mehrtens <hauke at hauke-m.de> [2020-10-04 17:10:59]:
> 
>> On 10/3/20 9:48 AM, Petr Štetiar wrote:
>>> Use valgrind and uci cli compiled with undefined, address and leak
>>> sanitizers.
>> ....
>>> diff --git a/tests/cram/test-san_uci_import.t b/tests/cram/test-san_uci_import.t
>>> new file mode 100644
>>> index 000000000000..7faed221f93e
>>> --- /dev/null
>>> +++ b/tests/cram/test-san_uci_import.t
>>> @@ -0,0 +1,15 @@
>>> +check that uci import is producing expected results:
>>> +
>>> +  $ [ -n "$BUILD_BIN_DIR" ] && export PATH="$BUILD_BIN_DIR:$PATH"
>>> +  $ export TEST_INPUTS="$TESTDIR/inputs"
>>> +  $ export FUZZ_CORPUS="$TESTDIR/../fuzz/corpus"
>>> +
>>> +  $ for file in $(LC_ALL=C find $FUZZ_CORPUS -type f | sort ); do
>>> +  >   uci-san import -f $file; \
>>> +  > done
> 
> BTW this above is a "standard" multiline shell construct (> prefix), so you
> can just add simple "echo $file" and see what is going on, like this:
> 
>  diff --git a/tests/cram/test_uci_import.t b/tests/cram/test_uci_import.t
>  index 8d5ab74ed4e7..e086ecf11ab1 100644
>  --- a/tests/cram/test_uci_import.t
>  +++ b/tests/cram/test_uci_import.t
>  @@ -5,6 +5,7 @@ check that uci import is producing expected results:
>     $ export FUZZ_CORPUS="$TESTDIR/../fuzz/corpus"
>  
>     $ for file in $(LC_ALL=C find $FUZZ_CORPUS -type f | sort ); do
>  +  >   echo "testing $file"; \
>     >   valgrind --quiet --leak-check=full uci import -f $file; \
>     > done
>     uci: I/O error
> 
>>> +  uci-san: I/O error
>>> +  uci-san: Parse error (invalid command) at line 0, byte 0
>>> +  uci-san: Parse error (invalid command) at line 1, byte 18
>>
>> I do not get this error. Which test case should trigger it?
> 
> That's quite strange as I'm getting consistent results with gcc 8,9,10 and
> clang 10 (the same version used on CI
> https://gitlab.com/ynezz/openwrt-uci/-/jobs/771521825).  Both cram/shuni2 test
> suites are run always for complete compiler matrix, fuzzer only under clang
> compiler for obvious reasons.

It looks like this file was not correctly added when I imported your
patch from patchwork:
tests/fuzz/corpus/id-000000,sig-06,src-000079,time-22005942,op-ext_AO,pos-8

I used the changes you committed to master and the tests are passing for me.

clang 7 is the default clang version in Debian stable. I do not want to
update so often. ;-)

Hauke

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20201005/36030d59/attachment-0001.sig>


More information about the openwrt-devel mailing list