From 4a62e3fbdf17337e9588b6d7b9edd5a65e37a813 Mon Sep 17 00:00:00 2001 From: Sarah GLINER Date: Wed, 25 Oct 2023 17:34:39 +0200 Subject: [PATCH] oui --- .../{_build_all.yml => build_all.yml} | 0 ...dated_build_db.yaml => refresh_inputs.yml} | 0 .../workflows/{_scan_all.yml => scan_all.yml} | 266 +++++++++++++++++- .../{_test_devices.yml => test_all.yml} | 95 ++++++- scripts/build_and_test/test_app.py | 9 +- scripts/build_and_test/utils.py | 6 +- 6 files changed, 365 insertions(+), 11 deletions(-) rename .github/workflows/{_build_all.yml => build_all.yml} (100%) rename .github/workflows/{check_outdated_build_db.yaml => refresh_inputs.yml} (100%) rename .github/workflows/{_scan_all.yml => scan_all.yml} (57%) rename .github/workflows/{_test_devices.yml => test_all.yml} (74%) diff --git a/.github/workflows/_build_all.yml b/.github/workflows/build_all.yml similarity index 100% rename from .github/workflows/_build_all.yml rename to .github/workflows/build_all.yml diff --git a/.github/workflows/check_outdated_build_db.yaml b/.github/workflows/refresh_inputs.yml similarity index 100% rename from .github/workflows/check_outdated_build_db.yaml rename to .github/workflows/refresh_inputs.yml diff --git a/.github/workflows/_scan_all.yml b/.github/workflows/scan_all.yml similarity index 57% rename from .github/workflows/_scan_all.yml rename to .github/workflows/scan_all.yml index 59c0cce..54d6ea3 100644 --- a/.github/workflows/_scan_all.yml +++ b/.github/workflows/scan_all.yml @@ -166,7 +166,7 @@ jobs: - name: Launch scan run: | - python3 scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref || 'master' }} --input_file input_${{ matrix.index }}.json --scan --${{ matrix.device }} --skip_setup --output_file scan_${{ matrix.device }}_${{ matrix.index }}.json + python3 scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref || 'master' }} --input_file input_${{ matrix.index }}.json --scan --${{ matrix.device }} --skip_setup --output_file scan_${{ matrix.device }}_${{ matrix.index }}.json --logs_file log_${{ matrix.device }}_{{ matrix.index }}.txt #- name: Push info to DB # run: | @@ -178,6 +178,13 @@ jobs: name: scan_${{ matrix.device }}_${{ matrix.index }}.json path: scan_${{ matrix.device }}_${{ matrix.index }}.json + - name: Archive log file + uses: actions/upload-artifact@v3 + continue-on-error: true + with: + name: log_${{ matrix.device }}_${{ matrix.index }}.txt + path: log_${{ matrix.device }}_${{ matrix.index }}.txt + info-devices: name: Setup scan infos by devices runs-on: ubuntu-latest @@ -249,6 +256,263 @@ jobs: name: merged_scan_${{ matrix.device }}.json path: merged_scan_${{ matrix.device }}.json + build-error_log: + name: Build error logs + runs-on: ubuntu-latest + needs: [scan-all, setup-devices] + steps: + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_1.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_2.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_3.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_4.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_5.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_6.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_7.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_8.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_9.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanos_10.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_1.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_2.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_3.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_4.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_5.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_6.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_7.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_8.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_9.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanosp_10.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_1.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_2.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_3.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_4.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_5.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_6.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_7.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_8.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_9.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_nanox_10.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_1.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_2.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_3.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_4.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_5.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_6.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_7.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_8.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_9.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_stax_10.txt + + - name: Merge all + continue-on-error: true + run: | + cat log_* > error_log.txt + + - name: Archive log error file + uses: actions/upload-artifact@v3 + continue-on-error: true + with: + name: error_log.txt + path: error_log.txt + info-all: name: Setup scan infos runs-on: ubuntu-latest diff --git a/.github/workflows/_test_devices.yml b/.github/workflows/test_all.yml similarity index 74% rename from .github/workflows/_test_devices.yml rename to .github/workflows/test_all.yml index 21c6594..bb7dc3d 100644 --- a/.github/workflows/_test_devices.yml +++ b/.github/workflows/test_all.yml @@ -134,17 +134,17 @@ jobs: - name: Launch test nanosp if: ${{ inputs.run_nanosp }} run: | - python scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref_nanosp }} --input_file input_${{ matrix.index }}.json --test --nanosp --skip_setup --output_file test_nanosp_${{ matrix.index }}.json + python scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref_nanosp }} --input_file input_${{ matrix.index }}.json --test --nanosp --skip_setup --output_file test_nanosp_${{ matrix.index }}.json --logs_file log_nanosp.txt - name: Launch test nanox if: ${{ inputs.run_nanox }} run: | - python scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref_nanox }} --input_file input_${{ matrix.index }}.json --test --nanox --skip_setup --output_file test_nanox_${{ matrix.index }}.json + python scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref_nanox }} --input_file input_${{ matrix.index }}.json --test --nanox --skip_setup --output_file test_nanox_${{ matrix.index }}.json --logs_file log_nanox.txt - name: Launch test stax if: ${{ inputs.run_stax }} run: | - python scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref_stax }} --input_file input_${{ matrix.index }}.json --test --stax --skip_setup --output_file test_stax_${{ matrix.index }}.json + python scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref_stax }} --input_file input_${{ matrix.index }}.json --test --stax --skip_setup --output_file test_stax_${{ matrix.index }}.json --logs_file log_stax.txt - name: Merge output files run: | @@ -155,6 +155,95 @@ jobs: name: test_output_${{ matrix.index }}.json path: test_output_${{ matrix.index }}.json + - name: Merge log file + continue-on-error: true + run: | + cat log_* > log_${{ matrix.index }}.txt + + - name: Archive log file + uses: actions/upload-artifact@v3 + continue-on-error: true + with: + name: log_${{ matrix.index }}.txt + path: log_${{ matrix.index }}.txt + + build-error_log: + name: Build error logs + runs-on: ubuntu-latest + needs: [test-all, setup-devices] + steps: + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_1.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_2.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_3.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_4.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_5.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_6.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_7.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_8.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_9.txt + + - name: Download files + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: log_10.txt + + - name: Merge all + continue-on-error: true + run: | + cat log_* > error_log.txt + + - name: Archive log error file + uses: actions/upload-artifact@v3 + continue-on-error: true + with: + name: error_log.txt + path: error_log.txt + info-devices: name: Setup test infos diff --git a/scripts/build_and_test/test_app.py b/scripts/build_and_test/test_app.py index 669a68f..56d8632 100644 --- a/scripts/build_and_test/test_app.py +++ b/scripts/build_and_test/test_app.py @@ -16,8 +16,8 @@ def test(model: str, app_test_path: Path, app_build_path: Path, test_params: str def install_dependencies(app_test_path: Path): - error = run_cmd("pip install -r requirements.txt", cwd=app_test_path, no_throw=True) - return error, "" + error, log = run_cmd("pip install -r requirements.txt", cwd=app_test_path, no_throw=True) + return error, log def test_device(device: Device, variant_param: str, app_build_path: Path, app_test_path: Path, sdk_path: Path, extra_flags: str, blacklist: str, test_params: str): @@ -30,7 +30,8 @@ def test_device(device: Device, variant_param: str, app_build_path: Path, app_te if device.model_name in blacklist: return "Skipped", log - if install_dependencies(app_test_path): + error, log = install_dependencies(app_test_path) + if error: print("Error installing dependencies") return "Fail", log @@ -86,6 +87,6 @@ def test_all_devices(devices: Devices, sdk_path: Path, app_json: dict, workdir: output["test"]["stax"] = stax_output print(output) - log = nanos_log + nanosp_output + nanox_log + stax_log + log = nanos_log + nanosp_log + nanox_log + stax_log return output, log diff --git a/scripts/build_and_test/utils.py b/scripts/build_and_test/utils.py index 9a64a66..a863a1a 100644 --- a/scripts/build_and_test/utils.py +++ b/scripts/build_and_test/utils.py @@ -25,9 +25,9 @@ def run_cmd(cmd: str, print(f"[run_cmd] Output:\n{ret.stdout}") error_log = f''' - ################################################################## - [run_cmd] Running: {cmd} from {cwd}" - ################################################################## +############################################################################### +[run_cmd] Running: {cmd} from {cwd}" +############################################################################### ''' + ret.stdout return ret.returncode, error_log