From a378744af30dc79c2b9fd7865086e62c4b24b8d1 Mon Sep 17 00:00:00 2001 From: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> Date: Fri, 24 May 2024 10:05:43 -0700 Subject: [PATCH] Github actions updates (#139) * Update build-codeql.yaml test codeql action Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml manual download Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml add back yest of build step Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml try all jobs Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml test all jobs Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml dvl tests Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Add files via upload Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Create readme Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * restructure * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * add test projects * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * update build_create_analyze_test.py to fail when different results are found * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * change when results get uploaded * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * fix exit code * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * update to use driver_snippet.c instead of other driver projects * add template path variable * fix path * fix path * test * fix template path * test * update template project to have arm configuration * fix msbuild command * fix driver_snippet.c * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * print results location * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * fix sarif copy and compare sarif results * add expected sarif results * Delete src/drivers/test/dvl_tests/readme Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> --- .github/workflows/build-codeql.yaml | 222 ++++++-- .../test/WDMTestTemplate/WDMTestTemplate.sln | 15 +- .../driver/fail_driver1.vcxproj | 48 +- src/drivers/test/build_create_analyze_test.py | 204 +++---- src/drivers/test/dvl_tests/dvl_tests.ps1 | 203 +++++++ .../expected_results/clean_expected.sarif | 448 ++++++++++++++++ .../expected_results/mustfix_expected.sarif | 504 ++++++++++++++++++ 7 files changed, 1442 insertions(+), 202 deletions(-) create mode 100644 src/drivers/test/dvl_tests/dvl_tests.ps1 create mode 100644 src/drivers/test/dvl_tests/expected_results/clean_expected.sarif create mode 100644 src/drivers/test/dvl_tests/expected_results/mustfix_expected.sarif diff --git a/.github/workflows/build-codeql.yaml b/.github/workflows/build-codeql.yaml index 8c3760aa..66e95d14 100644 --- a/.github/workflows/build-codeql.yaml +++ b/.github/workflows/build-codeql.yaml @@ -12,10 +12,11 @@ on: # Allow manual scheduling workflow_dispatch: - + jobs: - build-publish: + build: runs-on: windows-latest + permissions: contents: read packages: write @@ -30,22 +31,58 @@ jobs: path: . fetch-depth: 0 - - name: Download CodeQL CLI - uses: i3h/download-release-asset@v1.2.0 - with: - owner: "github" - repo: "codeql-cli-binaries" - tag: "v2.15.4" - file: "codeql-win64.zip" + - name: CodeQL Download + run: + Invoke-WebRequest -Uri "https://github.com/github/codeql-cli-binaries/releases/download/v${{ vars.CODEQL_VERSION }}/codeql-win64.zip" -OutFile codeql-win64.zip; + Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force; + Move-Item -Path .\codeql-zip\codeql -Destination .\codeql-cli\ + + - name: Install CodeQL pack dependencies + shell: cmd + run: | + pushd .\src + ..\codeql-cli\codeql.cmd pack install + popd + + - name: codeql version test + run: .\codeql-cli\codeql.exe version + + - name: Build must-fix driver suite + shell: cmd + run: .\codeql-cli\codeql.cmd query compile --check-only windows_mustfix_partial.qls - - name: Unzip CodeQL CLI - run: Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force + - name: Build recommended driver suite + shell: cmd + run: .\codeql-cli\codeql.cmd query compile --check-only windows_recommended_partial.qls - - name: Move CodeQL CLI folder to main subdirectory + - name: Build CA ported queries shell: cmd - continue-on-error: true # Required because robocopy returns 1 on success - run: robocopy /S /move .\codeql-zip\codeql .\codeql-cli\ - + run: .\codeql-cli\codeql.cmd query compile --check-only ported_driver_ca_checks.qls + + - name: Build all Windows queries + shell: cmd + run: .\codeql-cli\codeql.cmd query compile --check-only .\src + + test-query-health: + runs-on: windows-latest + needs: build + permissions: + contents: read + packages: write + steps: + - name: Enable long git paths + shell: cmd + run: git config --global core.longpaths true + - name: Clone self (windows-driver-developer-supplemental-tools) + uses: actions/checkout@v4 + with: + path: . + fetch-depth: 0 + - name: CodeQL Download + run: + Invoke-WebRequest -Uri "https://github.com/github/codeql-cli-binaries/releases/download/v${{ vars.CODEQL_VERSION }}/codeql-win64.zip" -OutFile codeql-win64.zip; + Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force; + Move-Item -Path .\codeql-zip\codeql -Destination .\codeql-cli\ - name: Install CodeQL pack dependencies shell: cmd run: | @@ -54,47 +91,94 @@ jobs: popd - name: codeql version test run: .\codeql-cli\codeql.exe version - - name: Setup Python uses: actions/setup-python@v5 with: python-version: 3.11 - - name: Install Python Packages run: | python -m pip install --upgrade pip pip install -r .\src\drivers\test\requirements.txt - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - - name: Run test script shell: pwsh - continue-on-error: true # Allow script to return non-zero exit code env: CONNECTION_STRING: ${{ secrets.CONNECTION_STRING }} ACCOUNT_KEY: ${{ secrets.ACCOUNT_KEY }} SHARE_NAME: ${{ secrets.SHARE_NAME }} CONTAINER_NAME: ${{ secrets.CONTAINER_NAME }} ACCOUNT_NAME: ${{ secrets.ACCOUNT_NAME }} - - run: python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results --connection_string "$env:CONNECTION_STRING" --share_name "$env:SHARE_NAME" --container_name "$env:CONTAINER_NAME" --storage_account_key "$env:ACCOUNT_KEY" --storage_account_name "$env:ACCOUNT_NAME" + run: python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results --connection_string "$env:CONNECTION_STRING" --share_name "$env:SHARE_NAME" --container_name "$env:CONTAINER_NAME" - - name: Build must-fix driver suite + test-codeql-latest-vs-current: + # Tests if the latest codeql version produces the same results as the current version. + runs-on: windows-latest + continue-on-error: true # Allow script to return non-zero exit code + needs: [build,test-query-health] + permissions: + contents: read + packages: write + steps: + - name: Enable long git paths shell: cmd - run: .\codeql-cli\codeql.cmd query compile --check-only windows_mustfix_partial.qls + run: git config --global core.longpaths true - - name: Build recommended driver suite + - name: Clone self (windows-driver-developer-supplemental-tools) + uses: actions/checkout@v4 + with: + path: . + fetch-depth: 0 + - name: CodeQL Download + run: + Invoke-WebRequest -Uri "https://github.com/github/codeql-cli-binaries/releases/download/v${{ vars.CODEQL_LATEST_VERSION }}/codeql-win64.zip" -OutFile codeql-win64.zip; + Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force; + Move-Item -Path .\codeql-zip\codeql -Destination .\codeql-cli\ + - name: Install CodeQL pack dependencies shell: cmd - run: .\codeql-cli\codeql.cmd query compile --check-only windows_recommended_partial.qls - - - name: Build CA ported queries + run: | + pushd .\src + ..\codeql-cli\codeql.cmd pack install + popd + - name: codeql version test + run: .\codeql-cli\codeql.exe version + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + - name: Install Python Packages + run: | + python -m pip install --upgrade pip + pip install -r .\src\drivers\test\requirements.txt + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + - name: Run test script + shell: pwsh + env: + CONNECTION_STRING: ${{ secrets.CONNECTION_STRING }} + ACCOUNT_KEY: ${{ secrets.ACCOUNT_KEY }} + SHARE_NAME: ${{ secrets.SHARE_NAME }} + CONTAINER_NAME: ${{ secrets.CONTAINER_NAME }} + ACCOUNT_NAME: ${{ secrets.ACCOUNT_NAME }} + run: python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results --connection_string "$env:CONNECTION_STRING" --share_name "$env:SHARE_NAME" + + test-pack-version-update: + runs-on: windows-latest + needs: build + permissions: + contents: read + packages: write + steps: + - name: Enable long git paths shell: cmd - run: .\codeql-cli\codeql.cmd query compile --check-only ported_driver_ca_checks.qls + run: git config --global core.longpaths true - - name: Build all Windows queries - shell: cmd - run: .\codeql-cli\codeql.cmd query compile --check-only .\src - + - name: Clone self (windows-driver-developer-supplemental-tools) + uses: actions/checkout@v4 + with: + path: . + fetch-depth: 0 + - name: Check for changes to qlpack shell: pwsh run: @@ -118,16 +202,86 @@ jobs: try{$old_qlpack_version = [version]($qlpack_changes -match "-version").Substring(10);} catch {"Changed qlpack.yml without updating version"; exit 1 } try{$new_qlpack_version = [version]($qlpack_changes -match "\+version").Substring(10);} catch {"Changed qlpack.yml without updating version"; exit 1 } if ($new_qlpack_version -gt $old_qlpack_version) { exit 0 } else { "qlpack.yml version not incremented"; exit 1 } + + test-create-dvl: + runs-on: windows-latest + needs: build + permissions: + contents: read + packages: write + steps: + - name: Enable long git paths + shell: cmd + run: git config --global core.longpaths true + + - name: Clone self (windows-driver-developer-supplemental-tools) + uses: actions/checkout@v4 + with: + path: . + fetch-depth: 0 + + - name: CodeQL Download + run: + Invoke-WebRequest -Uri "https://github.com/github/codeql-cli-binaries/releases/download/v${{ vars.CODEQL_VERSION }}/codeql-win64.zip" -OutFile codeql-win64.zip; + Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force; + Move-Item -Path .\codeql-zip\codeql -Destination .\codeql-cli\ + + - name: Install CodeQL pack dependencies + shell: cmd + run: | + pushd .\src + ..\codeql-cli\codeql.cmd pack install + popd + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Test DVL + run: src\drivers\test\dvl_tests\dvl_tests.ps1 + + - name: Archive code coverage results + uses: actions/upload-artifact@v4 + with: + name: dvl-outputs + path: | + clean_results\*.* + mustfix_results\*.* + + publish: + runs-on: windows-latest + needs: [build, test-pack-version-update, test-query-health] + permissions: + contents: read + packages: write + steps: + - name: Enable long git paths + shell: cmd + run: git config --global core.longpaths true + + - name: Clone self (windows-driver-developer-supplemental-tools) + uses: actions/checkout@v4 + with: + path: . + fetch-depth: 0 + - name: CodeQL Download + run: + Invoke-WebRequest -Uri "https://github.com/github/codeql-cli-binaries/releases/download/v${{ vars.CODEQL_VERSION }}/codeql-win64.zip" -OutFile codeql-win64.zip; + Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force; + Move-Item -Path .\codeql-zip\codeql -Destination .\codeql-cli\ + + - name: Install CodeQL pack dependencies + shell: cmd + run: | + pushd .\src + ..\codeql-cli\codeql.cmd pack install + popd - name: Publish New CodeQL Pack shell: pwsh env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: $build = git rev-parse --short HEAD; $version =( Select-String .\src\qlpack.yml -Pattern "version").line; $new_ver = "$version-alpha+$build"; (Get-Content .\src\qlpack.yml).Replace($version, $new_ver) | Set-Content .\src\qlpack.yml; .\codeql-cli\codeql.cmd pack publish --allow-prerelease ./src; - diff --git a/src/drivers/test/WDMTestTemplate/WDMTestTemplate.sln b/src/drivers/test/WDMTestTemplate/WDMTestTemplate.sln index b204d010..10bda3ff 100644 --- a/src/drivers/test/WDMTestTemplate/WDMTestTemplate.sln +++ b/src/drivers/test/WDMTestTemplate/WDMTestTemplate.sln @@ -7,18 +7,25 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fail_driver1", "driver\fail EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Release|ARM64 = Release|ARM64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|Win32.ActiveCfg = Debug|Win32 - {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|Win32.Build.0 = Debug|Win32 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|ARM64.Build.0 = Debug|ARM64 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|Win32.ActiveCfg = Debug|x64 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|Win32.Build.0 = Debug|x64 {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|x64.ActiveCfg = Debug|x64 {7F88D5C5-F05F-4817-89F5-C811053277A0}.Debug|x64.Build.0 = Debug|x64 - {7F88D5C5-F05F-4817-89F5-C811053277A0}.Release|Win32.ActiveCfg = Release|Win32 - {7F88D5C5-F05F-4817-89F5-C811053277A0}.Release|Win32.Build.0 = Release|Win32 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Release|ARM64.ActiveCfg = Release|ARM64 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Release|ARM64.Build.0 = Release|ARM64 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Release|ARM64.Deploy.0 = Release|ARM64 + {7F88D5C5-F05F-4817-89F5-C811053277A0}.Release|Win32.ActiveCfg = Release|x64 {7F88D5C5-F05F-4817-89F5-C811053277A0}.Release|x64.ActiveCfg = Release|x64 {7F88D5C5-F05F-4817-89F5-C811053277A0}.Release|x64.Build.0 = Release|x64 EndGlobalSection diff --git a/src/drivers/test/WDMTestTemplate/driver/fail_driver1.vcxproj b/src/drivers/test/WDMTestTemplate/driver/fail_driver1.vcxproj index 1d6f2dce..e15658c3 100644 --- a/src/drivers/test/WDMTestTemplate/driver/fail_driver1.vcxproj +++ b/src/drivers/test/WDMTestTemplate/driver/fail_driver1.vcxproj @@ -1,18 +1,18 @@  - + Debug - Win32 - - - Release - Win32 + ARM64 Debug x64 + + Release + ARM64 + Release x64 @@ -35,23 +35,23 @@ WindowsKernelModeDriver10.0 Driver - + Windows10 - True + False Desktop WDM WindowsKernelModeDriver10.0 Driver - + Windows10 - False + True Desktop WDM WindowsKernelModeDriver10.0 Driver - + Windows10 True Desktop @@ -66,26 +66,26 @@ - + - + - + fail_driver1 - + fail_driver1 - + fail_driver1 - + fail_driver1 @@ -94,19 +94,19 @@ Level4 - + false Level4 - + false Level4 - + false Level4 @@ -125,7 +125,7 @@ sha256 - + @@ -135,19 +135,21 @@ sha256 - + + USE_NTIFS=$(UseNTIFS);%(PreprocessorDefinitions) sha256 - + + USE_NTIFS=$(UseNTIFS);%(PreprocessorDefinitions) sha256 diff --git a/src/drivers/test/build_create_analyze_test.py b/src/drivers/test/build_create_analyze_test.py index 8fd025d2..707eeea5 100644 --- a/src/drivers/test/build_create_analyze_test.py +++ b/src/drivers/test/build_create_analyze_test.py @@ -766,15 +766,16 @@ def find_last_xlsx_file(curr_results_path): else: detailed = False - curr_results_timestamp = curr_results_path.split("--")[-1].replace(".xlsx", "") files = os.listdir() + print(files) files = [x for x in files if "diff" not in x] if detailed: - files = [x for x in files if x.endswith(".xlsx") and "detailed" in x and curr_results_timestamp not in x] + files = [x for x in files if x.endswith(".xlsx") and "detailed" in x and x != curr_results_path] else: - files = [x for x in files if x.endswith(".xlsx") and "detailed" not in x and curr_results_timestamp not in x] + files = [x for x in files if x.endswith(".xlsx") and "detailed" not in x and x != curr_results_path] files.sort(key=os.path.getmtime, reverse=True) - + if len(files) == 0: + return None return files[0] @@ -788,30 +789,23 @@ def compare_health_results(curr_results_path): Returns: None """ - if not args.connection_string or not args.share_name and not args.local_result_storage: + if not args.connection_string or not args.share_name: raise Exception("Azure credentials not provided. Cannot compare results.") - # get most recent xlsx results file - if args.local_result_storage: - prev_results = find_last_xlsx_file(curr_results_path) - if prev_results == None: - print("No previous results found.") - return None - else: - try: - prev_results = 'azure-'+curr_results_path - _ = download_file_from_azure(file_to_download=prev_results, - file_name=curr_results_path, file_directory="") - - except Exception as e: - if "ResourceNotFound" in str(e): - print("No previous results found. Uploading current results to Azure...") - upload_results_to_azure(file_to_upload=curr_results_path, - file_name=curr_results_path, file_directory="") - exit(1) - else: - print("Error downloading previous results ") - exit(1) + try: + prev_results = 'azure-'+curr_results_path + _ = download_file_from_azure(file_to_download=prev_results, + file_name=curr_results_path, file_directory="") + + except Exception as e: + if "ResourceNotFound" in str(e): + print("No previous results found. Uploading current results to Azure...") + upload_results_to_azure(file_to_upload=curr_results_path, + file_name=curr_results_path, file_directory="") + exit(1) + else: + print("Error downloading previous results ") + exit(1) prev_results_df = pd.read_excel(prev_results, index_col=0, sheet_name=0) prev_results_codeql_version_df = pd.read_excel(prev_results, index_col=0, sheet_name=1) @@ -838,6 +832,8 @@ def compare_health_results(curr_results_path): upload_results_to_azure(file_to_upload=curr_results_path, file_name=curr_results_path, file_directory="") exit(1) + + with pd.ExcelWriter("diff" + curr_results_path) as writer: diff_results.to_excel(writer, sheet_name="Diff") codeql_version_df.to_excel(writer, sheet_name="Current CodeQL Version") @@ -846,23 +842,25 @@ def compare_health_results(curr_results_path): prev_results_codeql_version_df.to_excel(writer, sheet_name="Previous CodeQL Version") prev_results_codeql_packs_df.to_excel(writer, sheet_name="Previous CodeQL Packs") prev_results_system_info_df.to_excel(writer, sheet_name="Previous System Info") - - print("Saved diff results") - # upload new results to Azure + print("Saved diff results") + if not args.local_result_storage: - - print("Uploading results") - upload_results_to_azure(file_to_upload=curr_results_path, - file_name=curr_results_path, file_directory="") - # upload diff to Azure + # upload new results to Azure + if args.overwrite_azure_results: + print("Uploading results") + upload_results_to_azure(file_to_upload=curr_results_path, + file_name=curr_results_path, file_directory="") + # upload diff to Azure print("Uploading diff results") upload_results_to_azure(file_to_upload="diff" + curr_results_path, - file_name="diff" + curr_results_path, file_directory="") + file_name="diff" + curr_results_path, file_directory="") - #upload_blob_to_azure("diff"+curr_results_path) # TODO this doesnt work in github actions - + if not all(diff_results.isnull().all()): + print("Differences found in results!") + exit(1) + else: + print("No differences found in results") # delete downloaded file - os.remove(prev_results) print("Deleted previous results") @@ -943,104 +941,30 @@ def find_sln_file(path): if __name__ == "__main__": # Sys input flags - parser = argparse.ArgumentParser(description='Build, create, and analyze CodeQL databases for testing queries. Running this script without any flags will run all queries on their respective driver template project with injected tests from driver_snippet.c') - parser.add_argument('-e', '--external_drivers', - help='Use external drivers at for testing instead of drivers in the repo', - type=str, - required=False, - ) - parser.add_argument('-l', '--no_clean', - help='Do not clean the working directory before running tests', - action='store_true', - required=False, - ) - parser.add_argument('-b', '--existing_database', - help='Use existing database at for testing instead of creating a new one', - type=str, - required=False, - ) - parser.add_argument('-d', '--debug_only', - help='Debug only', - action='store_true', - required=False, - ) - parser.add_argument('-r', '--release_only', - help='Release only', - action='store_true', - required=False, - ) - parser.add_argument('-n', '--no_build', - help='Do not build the driver before running the test', - action='store_true', - required=False, - ) - parser.add_argument('-o', '--override_template', - help='Override the template used for the test using