zgrab2/integration_tests/cleanup.sh
Andrew Sardone f45ab312bb
Move all test scripts into integration_tests/ directory
This is just a very minor directory organization change, but it has the
advantage of keeping a bunch of files out of the root directory and
packaging them together since they are related to each other.

Now, our `integration_tests/` directory has a nice pattern of
setup/cleanup/test.sh scripts at the top global level and at each module
level:

```
❯ tree --dirsfirst integration_tests
integration_tests
├── mysql
│   ├── util
│   │   ├── launch_mysql_container.sh
│   │   └── wait_for_mysqld.sh
│   ├── cleanup.sh
│   ├── setup.sh
│   ├── single_run.sh
│   └── test.sh
├── ssh
│   ├── cleanup.sh
│   ├── setup.sh
│   └── test.sh
├── cleanup.sh
├── setup.sh
└── test.sh

3 directories, 12 files
```

The scripts are runnable via:

```
./integration_tests/setup.sh && ./integration_tests/test.sh && ./integration_tests/cleanup.sh
```
2017-12-18 00:44:06 -05:00

31 lines
730 B
Bash
Executable File

#!/bin/bash
# Keep cleaning up, even if something fails
set +e
# Clean up after running the integration tests.
# Drop your cleanup script(s) in integration_tests/<protocol>/cleanup(.*).sh
# Run from root of project
TEST_DIR=$(dirname "$0")
cd "$TEST_DIR/.."
echo "Cleaning up integration tests..."
pushd integration_tests
for mod in $(ls); do
if [ -d "$mod" ]; then
pushd $mod
for cleanup in $(ls cleanup*.sh); do
echo "Cleaning up $mod (integration_tests/$mod/$cleanup)..."
if ! ./$cleanup; then
echo "Warning: cleanup for $mod/$cleanup failed with exit code $?"
fi
done
popd
fi
done
popd
echo "Integration test cleanup finished."