From 2cac82bc748b459c2822751b8db60b1771848127 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Fri, 8 Nov 2024 21:25:28 +0000 Subject: [PATCH 1/3] ci: Enable testing on Linux arm64 --- .github/workflows/build-and-test.yaml | 22 +++++++++++++++++++++- build-matrix.json | 1 - run_end_to_end_tests.py | 8 ++++++++ tests/karma.conf.js | 1 + tests/tests.js | 9 ++++++++- 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 9e778fe..0b19d10 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -112,6 +112,14 @@ jobs: libva2 libva-drm2 \ nodejs npm xvfb + - name: Install Chromium (non-Snap, arm64 Linux only) + if: runner.os == 'Linux' && matrix.target_arch == 'arm64' + run: | + sudo add-apt-repository ppa:xtradeb/apps -y + sudo apt update + sudo apt -y install chromium + echo "CHROME_BIN=chromium" >> $GITHUB_ENV + - name: Install Python deps run: | python3 -m pip install -r requirements.txt @@ -142,8 +150,20 @@ jobs: else WRAPPER="" fi + + if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target_arch }}' == 'arm64' ]]; then + # There is no Widevine CDM for Linux arm64 at this time. + # By setting this here instead of probing during the test, we can + # be sure to notice failures if Widevine disappears from our + # testing environment on platforms where this would not be + # expected. + EXTRA_ARGS="--no-test-widevine" + else + EXTRA_ARGS="" + fi + # Use the "spec" reporter for clearer logs in GitHub Actions - $WRAPPER python3 run_end_to_end_tests.py --reporters spec + $WRAPPER python3 run_end_to_end_tests.py --reporters spec $EXTRA_ARGS - name: Debug on failure uses: mxschmitt/action-tmate@v3.6 diff --git a/build-matrix.json b/build-matrix.json index 83d1ca7..b914c64 100644 --- a/build-matrix.json +++ b/build-matrix.json @@ -29,7 +29,6 @@ "comment2": "runners hosted by the owner, enabled by the ENABLE_SELF_HOSTED variable being set on the repo", "selfHosted": [ { - "DISABLED": "Disabled because there is no Chrome build for arm64 Linux to run the test cases. Need support for another browser through Karma.", "os": "self-hosted-linux-arm64", "os_name": "linux", "target_arch": "arm64" diff --git a/run_end_to_end_tests.py b/run_end_to_end_tests.py index c5e5c04..5d55aab 100755 --- a/run_end_to_end_tests.py +++ b/run_end_to_end_tests.py @@ -322,6 +322,12 @@ def main(): help='Random seed to reproduce failures') parser.add_argument('--filter', help='Plain text or regex filter for test cases') + parser.add_argument('--test-widevine', default=True, + action='store_true', + help='Test Widevine (the default)') + parser.add_argument('--no-test-widevine', dest='test_widevine', + action='store_false', + help='Do not test Widevine') parser.add_argument('--debug', action='store_true', help='Dump information about the configs and the ' + @@ -378,6 +384,8 @@ def main(): test_args += [ '--seed', args.seed ] if args.debug: test_args += [ '--debug', 'true' ] + if args.test_widevine: + test_args += [ '--testWidevine', 'true' ] for i in range(trials): # If the exit code was not 0, the tests in karma failed or crashed. diff --git a/tests/karma.conf.js b/tests/karma.conf.js index 3c1ea0f..705f607 100644 --- a/tests/karma.conf.js +++ b/tests/karma.conf.js @@ -22,6 +22,7 @@ module.exports = function(config) { filter: config.filter, seed: config.seed, debug: !!config.debug, + testWidevine: !!config.testWidevine, }, frameworks: ['jasmine'], files: [ diff --git a/tests/tests.js b/tests/tests.js index e5b4d3e..10db879 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -20,6 +20,7 @@ const TEST_DIR = 'test_assets/'; let player; let video; let doDebug = false; +let testWidevine = true; const jasmineEnv = jasmine.getEnv(); const originalJasmineExecute = jasmineEnv.execute.bind(jasmineEnv); @@ -37,6 +38,9 @@ jasmineEnv.execute = () => { // If the user asked us to debug, we can print manifest/playlist contents. doDebug = __karma__.config.debug; + // True if we're testing Widevine (the default). + testWidevine = __karma__.config.testWidevine; + // Set jasmine config. jasmineEnv.configure({ random, @@ -558,13 +562,16 @@ function liveTests(manifestUrl, format) { } function drmTests(manifestUrl, format) { - it('has widevine encryption enabled ' + format, async () => { + it('has Widevine encryption enabled ' + format, async () => { if (manifestUrl.includes('hls.m3u8')) { // https://github.com/shaka-project/shaka-packager/issues/1439 // Inappropriate key material in HLS outputs causes this test to fail. // Until this bug is resolved, skip this test for HLS. pending('Skipped due to shaka-packager#1439'); } + if (!testWidevine) { + pending('Skipped due to command line flag'); + } const inputConfigDict = { 'inputs': [ From 68dc67079c7059aa17e871e8ece927061b7358e0 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Fri, 8 Nov 2024 22:06:44 +0000 Subject: [PATCH 2/3] Disable Chrome sandbox in Docker --- .github/workflows/build-and-test.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 0b19d10..dbcebf6 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -118,7 +118,15 @@ jobs: sudo add-apt-repository ppa:xtradeb/apps -y sudo apt update sudo apt -y install chromium - echo "CHROME_BIN=chromium" >> $GITHUB_ENV + + # Running inside a Docker container, we need to kill the sandbox. + cat >/usr/local/bin/chromium <> $GITHUB_ENV - name: Install Python deps run: | From 790c0bec1e27672781f14fdea7115c24259a6f83 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Fri, 8 Nov 2024 22:43:21 +0000 Subject: [PATCH 3/3] Escape heredoc --- .github/workflows/build-and-test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index dbcebf6..8d80eb4 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -120,9 +120,10 @@ jobs: sudo apt -y install chromium # Running inside a Docker container, we need to kill the sandbox. + # Heredocs interpolate variables, so escape the dollar sign below. cat >/usr/local/bin/chromium <