zgrab2/integration_tests/new.sh

42 lines
780 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Utility script for scaffolding stub test files for a new protocol
# Run from root of project
TEST_DIR=$(dirname "$0")
cd "$TEST_DIR/.."
if [ "$#" -ne 1 ]
then
echo "Usage: ./integration_tests/new.sh <new_protocol_name>"
exit 1
fi
module_name="$1"
module_path="integration_tests/$module_name"
mkdir -p $module_path
cat << EOF > $module_path/setup.sh
#!/usr/bin/env bash
echo "Tests setup for $module_name"
EOF
chmod +x $module_path/setup.sh
cat << EOF > $module_path/test.sh
#!/usr/bin/env bash
echo "Tests runner for $module_name"
EOF
chmod +x $module_path/test.sh
cat << EOF > $module_path/cleanup.sh
#!/usr/bin/env bash
echo "Tests cleanup for $module_name"
EOF
chmod +x $module_path/cleanup.sh
2017-12-18 16:44:05 +00:00
echo "Test files scaffolded in $module_path"