Skip to content

Commit

Permalink
Merge pull request #285 from AsherGlick/make_test_sanity_checks
Browse files Browse the repository at this point in the history
Adding sanity checks and usage to make_test.sh
  • Loading branch information
AsherGlick authored May 20, 2024
2 parents 8e68914 + 44a5343 commit eacede1
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions xml_converter/integration_tests/make_test.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
#!/bin/bash

if [[ $# -eq 0 || "$1" == "-h" || "$1" == "--help" ]]; then
echo "make_test.sh is used to create a new integration test. It creates a skeleton of"
echo "the files that are necessary for an integration test so that they can be easily"
echo "edited, instead of needing to remember all of the files that must be created"
echo "for each new integration test."
echo ""
echo "Usage:"
echo " ./make_test.sh <test_name>"
echo " ./make_test.sh my_new_test"
echo " ./make_test.sh [-h,--help]"
fi

# Fix the working directory if the script is being executed from somewhere
# other than its own directory.
cd "$(dirname "$0")"

# Base testcase directory
mkdir -p test_cases/$1

# Testcase configuration
touch test_cases/$1/testcase.yaml
echo 'input_paths: ' >> test_cases/$1/testcase.yaml
echo ' "pack": "xml"' >> test_cases/$1/testcase.yaml
echo 'expected_stdout: |' >> test_cases/$1/testcase.yaml
echo 'expected_stderr: |' >> test_cases/$1/testcase.yaml
echo 'expected_returncode: 0' >> test_cases/$1/testcase.yaml

# Configuration Data
yaml_file="test_cases/${1}/testcase.yaml"
if [ ! -f "$yaml_file" ]; then
touch "$yaml_file"
echo 'input_paths: ' >> "$yaml_file"
echo ' "pack": "xml"' >> "$yaml_file"
echo 'expected_stdout: |' >> "$yaml_file"
echo 'expected_stderr: |' >> "$yaml_file"
echo 'expected_returncode: 0' >> "$yaml_file"
else
echo "$yaml_file already exists, skipping setting it up"
fi


# Input folder and test marker pack
mkdir -p test_cases/$1/input/pack


# Output folders and blank output files
mkdir -p test_cases/$1/output_proto
touch test_cases/$1/output_proto/markers.bin
Expand Down

0 comments on commit eacede1

Please sign in to comment.