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.
  • Loading branch information
daniloegea committed Oct 1, 2024
1 parent 337eab4 commit 30a2144
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions tests/config_fuzzer/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,28 @@ 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"
cat ${yaml}
error=1
fi

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

echo "$(date) - Done"

Expand Down

0 comments on commit 30a2144

Please sign in to comment.