From f65b40f298ce584c53aecf6deb9e10f283634f66 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 24 Sep 2023 15:09:06 -0700 Subject: [PATCH 1/2] InstCountCI: Fail if inst count has changed --- Source/Tools/CodeSizeValidation/Main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Tools/CodeSizeValidation/Main.cpp b/Source/Tools/CodeSizeValidation/Main.cpp index 6cabcb55d..9f20a0ab8 100644 --- a/Source/Tools/CodeSizeValidation/Main.cpp +++ b/Source/Tools/CodeSizeValidation/Main.cpp @@ -286,10 +286,8 @@ static bool TestInstructions(FEXCore::Context::Context *CTX, FEXCore::Core::Inte LogMan::Msg::EFmt("Fail: '{}': {} host instructions", CurrentTest->TestInst, INSTStats->first.HostCodeInstructions); LogMan::Msg::EFmt("Fail: Test took {} instructions but we expected {} instructions!", INSTStats->first.HostCodeInstructions, CurrentTest->ExpectedInstructionCount); - if (CurrentTest->Optimal) { - // Don't count the test as a failure if it's known non-optimal. - TestsPassed = false; - } + // Fail the test if the instruction count has changed at all. + TestsPassed = false; } // Go to the next test. From 02ff9f200cd75ceb6840b510fe3ae710cc5e2f66 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 24 Sep 2023 15:09:28 -0700 Subject: [PATCH 2/2] InstCountCI: Upload diff and check for failure --- .github/workflows/instcountci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/instcountci.yml b/.github/workflows/instcountci.yml index e99d39a4e..21a1919f5 100644 --- a/.github/workflows/instcountci.yml +++ b/.github/workflows/instcountci.yml @@ -86,6 +86,25 @@ jobs: working-directory: ${{runner.workspace}}/build run: mv ${{runner.workspace}}/build/Testing/Temporary/LastTest.log ${{runner.workspace}}/build/Testing/Temporary/LastTest_InstCountCI.log || true + - name: Update local repo instcount + if: ${{ always() }} + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config $BUILD_TYPE --target instcountci_update_tests + + - name: Get instcountCI diff + if: ${{ always() }} + shell: bash + working-directory: ${{github.workspace}}/ + run: git diff --output=${{runner.workspace}}/build/InstCountCI.diff + + - name: Check if InstCountCI Diff exists + if: ${{ always() }} + shell: bash + working-directory: ${{github.workspace}}/ + # Check if the file is empty + run: sh -c "! test -s ${{runner.workspace}}/build/InstCountCI.diff" + - name: Truncate test results if: ${{ always() }} shell: bash @@ -107,3 +126,12 @@ jobs: path: ${{runner.workspace}}/build/Testing/Temporary/LastTest_*.log retention-days: 3 + - name: Upload results InstCountCI + if: ${{ always() }} + uses: 'actions/upload-artifact@v3' + timeout-minutes: 1 + with: + name: Results-${{ env.runner_name }}-instcountci + path: ${{runner.workspace}}/build/InstCountCI.diff + retention-days: 3 +