Skip to content

Commit 31c60e5

Browse files
committed
Java: Update the flow test generator to create ext.yml files.
1 parent 6dc798f commit 31c60e5

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

java/ql/src/utils/flowtestcasegenerator/GenerateFlowTestCase.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
GenerateFlowTestCase.py specsToTest.csv projectPom.xml outdir [--force]
1717
1818
This generates test cases exercising function model specifications found in specsToTest.csv
19-
producing files Test.java, test.ql and test.expected in outdir.
19+
producing files Test.java, test.ql, test.ext.yml and test.expected in outdir.
2020
2121
projectPom.xml should be a Maven pom sufficient to resolve the classes named in specsToTest.csv.
2222
Typically this means supplying a skeleton POM <dependencies> section that retrieves whatever jars
@@ -54,12 +54,11 @@
5454

5555
resultJava = os.path.join(sys.argv[3], "Test.java")
5656
resultQl = os.path.join(sys.argv[3], "test.ql")
57-
resultYml = os.path.join(sys.argv[3], "test.model.yml")
58-
resultPack = os.path.join(sys.argv[3], "qlpack.yml")
57+
resultYml = os.path.join(sys.argv[3], "test.ext.yml")
5958

60-
if not force and (os.path.exists(resultJava) or os.path.exists(resultQl) or os.path.exists(resultYml) or os.path.exists(resultPack)):
61-
print("Won't overwrite existing files '%s', '%s', '%s' or '%s'." %
62-
(resultJava, resultQl, resultYml, resultPack), file=sys.stderr)
59+
if not force and (os.path.exists(resultJava) or os.path.exists(resultQl) or os.path.exists(resultYml)):
60+
print("Won't overwrite existing files '%s', '%s' or '%s'." %
61+
(resultJava, resultQl, resultYml), file=sys.stderr)
6362
sys.exit(1)
6463

6564
workDir = tempfile.mkdtemp()
@@ -231,18 +230,6 @@ def copyfile(fromName, toFileHandle):
231230
{models}
232231
"""
233232
f.write(dataextensions)
234-
# Make a qlpack file such that the extension will be picked up
235-
with open(resultPack, "w") as f:
236-
f.write("""name: example-test-pack
237-
version: 0.0.0
238-
extractor: java
239-
dependencies:
240-
codeql/java-all: '*'
241-
codeql/java-queries: '*'
242-
codeql/java-tests: '*'
243-
dataExtensions:
244-
- test.model.yml
245-
""")
246233

247234
# Make an empty .expected file, since this is an inline-exectations test
248235
with open(os.path.join(sys.argv[3], "test.expected"), "w"):

0 commit comments

Comments
 (0)