Skip to content

Commit

Permalink
config_fuzzer: run generate -i against the entire dataset
Browse files Browse the repository at this point in the history
Now that the datalist was replaced with hash tables, run the generator
with --ignore-errors against the entire dataset. The datalist was
leaking memory and causing ASAN to crash the test.

Also limit the value of path-cost to avoid triggering a g_assert(v <
G_MACUINT).
  • Loading branch information
daniloegea committed Oct 1, 2024
1 parent 337eab4 commit 5dd0b9e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
37 changes: 17 additions & 20 deletions tests/config_fuzzer/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,26 @@ echo "$(date) - Done"

echo "$(date) - Running netplan generate -i"

for yaml in ${FAKEDATADIR}/*.yaml
do
rm -rf fakeroot3
mkdir -p fakeroot3/etc/netplan
cp ${yaml} fakeroot3/etc/netplan/
# Run the generator against the entire dataset

OUTPUT=$(${NETPLAN_GENERATE_PATH} --root-dir fakeroot3 -i 2>&1)
code=$?
if [ $code -eq 139 ] || [ $code -eq 245 ] || [ $code -eq 133 ]
then
echo "GENERATE --ignore-errors CRASHED"
cat ${yaml}
error=1
fi
rm -rf fakeroot3
mkdir -p fakeroot3/etc/
mv ${FAKEDATADIR} fakeroot3/etc/netplan

if grep 'detected memory leaks' <<< "$OUTPUT" > /dev/null
then
echo "GENERATE --ignore-errors MEMORY LEAK DETECTED"
cat ${yaml}
error=1
fi
OUTPUT=$(${NETPLAN_GENERATE_PATH} --root-dir fakeroot3 -i 2>&1)
code=$?
# code 134 happens when a g_assert() is triggered
if [ $code -eq 139 ] || [ $code -eq 245 ] || [ $code -eq 133 ] || [ $code -eq 134 ]
then
echo "GENERATE --ignore-errors CRASHED"
error=1
fi

done
if grep 'detected memory leaks' <<< "$OUTPUT" > /dev/null
then
echo "GENERATE --ignore-errors MEMORY LEAK DETECTED"
error=1
fi

echo "$(date) - Done"

Expand Down
6 changes: 6 additions & 0 deletions tests/config_fuzzer/schemas/bridges.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,18 @@ const bridges_schema = {
properties: {
eth0: {
type: "integer",
minimum: 0,
maximum: 4000000000
},
eth1: {
type: "integer",
minimum: 0,
maximum: 4000000000
},
eth2: {
type: "integer",
minimum: 0,
maximum: 4000000000
},
}
},
Expand Down

0 comments on commit 5dd0b9e

Please sign in to comment.