summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2014-12-26 19:31:47 -0600
committerNicolas Williams <nico@cryptonector.com>2014-12-26 23:05:57 -0600
commit845ad5e96909ce8111933c8a12e63ac09c77d31e (patch)
tree671d2eb1c2f3e41b9adc610630ae9f1c59db47d2
parent243b1f8e5e370d7b6f494346ef1477e73480f1a9 (diff)
Fuzz JSON parser
-rwxr-xr-xtests/run15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/run b/tests/run
index 878e697a..09703e11 100755
--- a/tests/run
+++ b/tests/run
@@ -123,6 +123,21 @@ $VALGRIND $Q ./jq -c '. as $d|path(..) as $p|$d|getpath($p)|scalars_or_empty|[$p
$VALGRIND $Q ./jq --stream -c '.|select(length==2)' < "$PWD/tests/torture/input0.json" > $d/out1
diff $d/out0 $d/out1
+## Fuzz parser
+
+if dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null; then
+ # Have a /dev/urandom, good
+ set -x
+ $VALGRIND $Q ./jq --seq . $d/rand >/dev/null 2>&1
+ $VALGRIND $Q ./jq --seq --stream . $d/rand >/dev/null 2>&1
+ dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null
+ $VALGRIND $Q ./jq --seq . $d/rand >/dev/null 2>&1
+ $VALGRIND $Q ./jq --seq --stream . $d/rand >/dev/null 2>&1
+ dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null
+ $VALGRIND $Q ./jq --seq . $d/rand >/dev/null 2>&1
+ $VALGRIND $Q ./jq --seq --stream . $d/rand >/dev/null 2>&1
+fi
+
## Test library/module system
mods=$PWD/tests/modules