diff options
| author | xusheng <xusheng@vector35.com> | 2020-10-27 17:03:33 +0800 |
|---|---|---|
| committer | Xusheng <xusheng@vector35.com> | 2020-11-16 10:49:47 +0800 |
| commit | a24b3303087c81135f7e2222adcbd014b988abac (patch) | |
| tree | 0967cc1bae2e94f8f54e17268d15140fbcdbe922 /suite/generator.py | |
| parent | 94dd8ee0871f32f1f9cb98eeba69980e33e3ec4e (diff) | |
support packaging/unpacking bndb files
Diffstat (limited to 'suite/generator.py')
| -rwxr-xr-x | suite/generator.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/suite/generator.py b/suite/generator.py index 12072f32..63ae64ff 100755 --- a/suite/generator.py +++ b/suite/generator.py @@ -261,12 +261,20 @@ def generate(test_store, outdir, exclude_binaries): allfiles = sorted(testcommon.get_file_list(test_store)) for progress, testfile in enumerate(allfiles): oraclefile = None + zip_only = False if testfile.endswith(".gitignore"): continue if testfile.endswith(".pkl"): continue elif testfile.endswith(".DS_Store"): continue + elif testfile.endswith(".bndb"): + # For databases, we do not wish to create oracle data for them + # However, we do wish them to be zipped + zip_only = True + oraclefile = testfile + elif testfile.endswith(".bndb.zip"): + continue elif testfile.endswith(".zip"): # We have a zipped binary unzip it so we can rebaseline with zipfile.ZipFile(testfile, "r") as zf: @@ -282,6 +290,15 @@ def generate(test_store, outdir, exclude_binaries): # We have a binary that isn't zipped use it as a new test case oraclefile = testfile + # create the zip archive for the file + if not os.path.exists(oraclefile + ".zip"): + with zipfile.ZipFile(oraclefile + ".zip", "w") as zf: + zf.write(oraclefile, os.path.relpath(oraclefile, start=os.path.dirname(__file__))) + + if zip_only: + os.unlink(oraclefile) + continue + oraclefile_rel = os.path.relpath(oraclefile, start=os.path.dirname(__file__)) # Now generate the oracle data @@ -306,10 +323,6 @@ def generate(test_store, outdir, exclude_binaries): binary_oracle.add_entry(test_data, method) binary_oracle.close() - if not os.path.exists(oraclefile + ".zip"): - with zipfile.ZipFile(oraclefile + ".zip", "w") as zf: - zf.write(oraclefile, os.path.relpath(oraclefile, start=os.path.dirname(__file__))) - os.unlink(oraclefile) update_progress(len(allfiles), len(allfiles), "Generating binary unit tests complete", True) |
