Add help text to GenerateFlowTestCase.py

This commit is contained in:
Chris Smowton
2021-06-04 18:26:42 +01:00
parent 5f1a491516
commit b1af90991d

20
java/ql/src/utils/GenerateFlowTestCase.py Normal file → Executable file
View File

@@ -1,3 +1,5 @@
#!/usr/bin/python3
import errno
import json
import os
@@ -9,6 +11,24 @@ import subprocess
import sys
import tempfile
if any(s == "--help" for s in sys.argv):
print("""Usage:
GenerateFlowTestCase.py specsToTest.ssv projectPom.xml outdir
This generates test cases exercising taint flow specifications found in specsToTest.ssv
producing files Test.java, test.ql and test.expected in outdir.
projectPom.xml should be a Maven pom sufficient to resolve the classes named in specsToTest.ssv.
Typically this means supplying a skeleton POM <dependencies> section that retrieves whatever jars
contain the needed classes.
Requirements: `mvn` and `codeql` should both appear on your path.
After test generation completes, any lines in specsToTest.ssv that didn't produce tests are output.
If this happens, check the spelling of class and method names, and the syntax of input and output specifications.
""")
sys.exit(0)
if len(sys.argv) != 4:
print("Usage: GenerateFlowTestCase.py specsToTest.ssv projectPom.xml outdir", file=sys.stderr)
print("specsToTest.ssv should contain SSV rows describing method taint-propagation specifications to test", file=sys.stderr)