oss-fuzz-copy.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. set -e
  3. # --------------------------------------------------------------------
  4. # Copies all the corpus files, dict and options to the $OUT directory.
  5. # This script is only used on oss-fuzz directly
  6. # --------------------------------------------------------------------
  7. fuzzerFiles=$(find $SRC/open62541/tests/fuzz/ -name "*.cc")
  8. for F in $fuzzerFiles; do
  9. fuzzerName=$(basename $F .cc)
  10. if [ -d "$SRC/open62541/tests/fuzz/${fuzzerName}_corpus" ]; then
  11. # first combine any files in subfolders to one single binary file
  12. subDirs=$(find $SRC/open62541/tests/fuzz/${fuzzerName}_corpus -maxdepth 1 -mindepth 1 -type d)
  13. for dirPath in $subDirs; do
  14. dir=$(basename $dirPath)
  15. outPath=$SRC/open62541/tests/fuzz/${fuzzerName}_corpus/$dir.bin
  16. if [ -f $outPath ]; then
  17. rm $outPath;
  18. fi
  19. echo "Combining content of $dir into $outPath"
  20. cat $dirPath/*.bin > $outPath
  21. done
  22. zip -j $OUT/${fuzzerName}_seed_corpus.zip $SRC/open62541/tests/fuzz/${fuzzerName}_corpus/*
  23. fi
  24. done
  25. cp $SRC/open62541/tests/fuzz/*.dict $SRC/open62541/tests/fuzz/*.options $OUT/