From 054c4155ab68d715f89cfc9469a120adf3147a71 Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Sat, 30 Aug 2025 11:14:15 -0700 Subject: [PATCH 1/8] Add a GitHub actions check test262.properties Check if the test262.properties file was updated correctly using the built-in tools, as opposed to being edited manually. Also create the "tools" directory, where I suspect other handy scripts can be kept. --- .github/workflows/check262.yml | 29 +++++++++++++++++++++++++++++ tools/check-test262.sh | 18 ++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/check262.yml create mode 100644 tools/check-test262.sh diff --git a/.github/workflows/check262.yml b/.github/workflows/check262.yml new file mode 100644 index 0000000000..a5d46bebc2 --- /dev/null +++ b/.github/workflows/check262.yml @@ -0,0 +1,29 @@ +name: Check Test262 Properties + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: read-all + +jobs: + check262: + runs-on: ubuntu-latest + name: Check262 Tests + steps: + - name: Check out Rhino + uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2 + - name: Check out test262 + # We don't actually want all the history for this part + run: git submodule update --init --single-branch + - name: Set up Java + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + # This test requires Java 11 only + with: + java-version: 11 + distribution: 'adopt' + - name: Run Check + run: >- + ./tools/check-test262.sh \ No newline at end of file diff --git a/tools/check-test262.sh b/tools/check-test262.sh new file mode 100644 index 0000000000..89628d2fe0 --- /dev/null +++ b/tools/check-test262.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +function computeSum() { + return $(sum $1 | awk '{print $1}') +} +export RHINO_TEST_JAVA_VERSION=11 + +sumBefore=$(computeSum ./tests/testsrc/test262.properties) + +./gradlew :tests:test --tests Test262SuiteTest -DupdateTest262properties + +sumAfter=$(computeSum ./tests/testsrc/test262.properties) +if [ "$sumBefore" != "$sumAfter" ]; then + echo "test262.properties has not been properly updated using the built-in tools." + echo "Please follow the instructions in tests/README.md to update it" + echo "and include the updated file in your PR." + exit 1 +fi From c894649cee2ab653c35b7087a7538ccc955bb4b2 Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Sat, 30 Aug 2025 11:27:50 -0700 Subject: [PATCH 2/8] Make test file executable --- tools/check-test262.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/check-test262.sh diff --git a/tools/check-test262.sh b/tools/check-test262.sh old mode 100644 new mode 100755 From d05dab70ffc5ac51735388039a08b5d54a689f3e Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Sat, 30 Aug 2025 11:42:49 -0700 Subject: [PATCH 3/8] Try another approach. --- .github/workflows/check262.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check262.yml b/.github/workflows/check262.yml index a5d46bebc2..fdc6e9652a 100644 --- a/.github/workflows/check262.yml +++ b/.github/workflows/check262.yml @@ -16,14 +16,28 @@ jobs: - name: Check out Rhino uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2 - name: Check out test262 - # We don't actually want all the history for this part run: git submodule update --init --single-branch - name: Set up Java uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - # This test requires Java 11 only with: java-version: 11 distribution: 'adopt' - - name: Run Check + - name: Check current state of properties file + id: hashBefore + run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT + - name: Run test262 tests run: >- - ./tools/check-test262.sh \ No newline at end of file + ./gadlew :tests:test --tests Test262SuiteTest -DupdateTest262properties + - name: Check updated state of properties file + id: hashAfter + run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT + - name: Compare results + run: | + if [ "${{ steps.hashBefore.outputs.hash }}" != "${{ steps.hashAfter.outputs.hash }}" ]; then + echo "The test262.properties file was not updated properly." + echo "Please follow the instructions in tests/README.md to update it." + git --no-pager diff ./tests/testsrc/test262.properties + exit 1 + else + echo "The test262.properties file is up to date." + fi From 51a08e3de3ae4932711e0abcf2e240ce9d97c8ff Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Sat, 30 Aug 2025 11:43:38 -0700 Subject: [PATCH 4/8] Typo --- .github/workflows/check262.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check262.yml b/.github/workflows/check262.yml index fdc6e9652a..ca20de82e7 100644 --- a/.github/workflows/check262.yml +++ b/.github/workflows/check262.yml @@ -27,7 +27,7 @@ jobs: run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT - name: Run test262 tests run: >- - ./gadlew :tests:test --tests Test262SuiteTest -DupdateTest262properties + ./gradlew :tests:test --tests Test262SuiteTest -DupdateTest262properties - name: Check updated state of properties file id: hashAfter run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT From ed9d9a67427946d5e5c182b02e13fdc0d4e264a1 Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Sat, 30 Aug 2025 11:45:55 -0700 Subject: [PATCH 5/8] Fix script --- .github/workflows/check262.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check262.yml b/.github/workflows/check262.yml index ca20de82e7..a258401da4 100644 --- a/.github/workflows/check262.yml +++ b/.github/workflows/check262.yml @@ -19,13 +19,18 @@ jobs: run: git submodule update --init --single-branch - name: Set up Java uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + # Need 21 to run framework and 11 to run the actual tests with: - java-version: 11 + java-version: | + 11 + 21 distribution: 'adopt' - name: Check current state of properties file id: hashBefore run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT - name: Run test262 tests + env: + RHINO_TEST_JAVA_VERSION: "11" run: >- ./gradlew :tests:test --tests Test262SuiteTest -DupdateTest262properties - name: Check updated state of properties file From 019b9e19db318780eedfea7fa536eee73bab98de Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Sat, 30 Aug 2025 11:54:48 -0700 Subject: [PATCH 6/8] Innocent change, let's see what happens --- tests/testsrc/test262.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testsrc/test262.properties b/tests/testsrc/test262.properties index 84549a15e4..9019a2ab9a 100644 --- a/tests/testsrc/test262.properties +++ b/tests/testsrc/test262.properties @@ -25,7 +25,7 @@ annexB/built-ins 58/241 (24.07%) RegExp/RegExp-control-escape-russian-letter.js compiled RegExp/RegExp-leading-escape-BMP.js RegExp/RegExp-trailing-escape-BMP.js - String/prototype/anchor/length.js + String/prototype/anchor String/prototype/fontcolor/length.js String/prototype/fontsize/length.js String/prototype/link/length.js From a8b11192421b5a8726960d0efde1899b38d115c1 Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Sat, 30 Aug 2025 15:42:42 -0700 Subject: [PATCH 7/8] Revert "Innocent change, let's see what happens" This reverts commit 019b9e19db318780eedfea7fa536eee73bab98de. --- tests/testsrc/test262.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testsrc/test262.properties b/tests/testsrc/test262.properties index 9019a2ab9a..84549a15e4 100644 --- a/tests/testsrc/test262.properties +++ b/tests/testsrc/test262.properties @@ -25,7 +25,7 @@ annexB/built-ins 58/241 (24.07%) RegExp/RegExp-control-escape-russian-letter.js compiled RegExp/RegExp-leading-escape-BMP.js RegExp/RegExp-trailing-escape-BMP.js - String/prototype/anchor + String/prototype/anchor/length.js String/prototype/fontcolor/length.js String/prototype/fontsize/length.js String/prototype/link/length.js From ef2d2962d8665206a33d6e95a6bdab324e2a4b61 Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Sat, 30 Aug 2025 15:45:41 -0700 Subject: [PATCH 8/8] Now try moving the new check to the main action --- .github/workflows/check262.yml | 48 ---------------------------------- .github/workflows/gradle.yml | 21 +++++++++++++++ tools/check-test262.sh | 18 ------------- 3 files changed, 21 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/check262.yml delete mode 100755 tools/check-test262.sh diff --git a/.github/workflows/check262.yml b/.github/workflows/check262.yml deleted file mode 100644 index a258401da4..0000000000 --- a/.github/workflows/check262.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Check Test262 Properties - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -permissions: read-all - -jobs: - check262: - runs-on: ubuntu-latest - name: Check262 Tests - steps: - - name: Check out Rhino - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2 - - name: Check out test262 - run: git submodule update --init --single-branch - - name: Set up Java - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - # Need 21 to run framework and 11 to run the actual tests - with: - java-version: | - 11 - 21 - distribution: 'adopt' - - name: Check current state of properties file - id: hashBefore - run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT - - name: Run test262 tests - env: - RHINO_TEST_JAVA_VERSION: "11" - run: >- - ./gradlew :tests:test --tests Test262SuiteTest -DupdateTest262properties - - name: Check updated state of properties file - id: hashAfter - run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT - - name: Compare results - run: | - if [ "${{ steps.hashBefore.outputs.hash }}" != "${{ steps.hashAfter.outputs.hash }}" ]; then - echo "The test262.properties file was not updated properly." - echo "Please follow the instructions in tests/README.md to update it." - git --no-pager diff ./tests/testsrc/test262.properties - exit 1 - else - echo "The test262.properties file is up to date." - fi diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index eac6787aa2..528753ba57 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -62,3 +62,24 @@ jobs: with: name: reports-java-11 path: '*/build/reports' + - name: Check current state of test262.properties + id: hashBefore + run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT + - name: Run test262 tests + env: + RHINO_TEST_JAVA_VERSION: "11" + run: >- + ./gradlew :tests:test --tests Test262SuiteTest -DupdateTest262properties + - name: Check updated state of test262.properties + id: hashAfter + run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT + - name: Compare test262 results + run: | + if [ "${{ steps.hashBefore.outputs.hash }}" != "${{ steps.hashAfter.outputs.hash }}" ]; then + echo "The test262.properties file was not updated properly." + echo "Please follow the instructions in tests/README.md to update it." + git --no-pager diff ./tests/testsrc/test262.properties + exit 1 + else + echo "The test262.properties file is up to date." + fi diff --git a/tools/check-test262.sh b/tools/check-test262.sh deleted file mode 100755 index 89628d2fe0..0000000000 --- a/tools/check-test262.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -function computeSum() { - return $(sum $1 | awk '{print $1}') -} -export RHINO_TEST_JAVA_VERSION=11 - -sumBefore=$(computeSum ./tests/testsrc/test262.properties) - -./gradlew :tests:test --tests Test262SuiteTest -DupdateTest262properties - -sumAfter=$(computeSum ./tests/testsrc/test262.properties) -if [ "$sumBefore" != "$sumAfter" ]; then - echo "test262.properties has not been properly updated using the built-in tools." - echo "Please follow the instructions in tests/README.md to update it" - echo "and include the updated file in your PR." - exit 1 -fi