Skip to content

Commit 3e81b29

Browse files
committed
more gh actions SharedArrayBuffer debugging
1 parent 8e62668 commit 3e81b29

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

.github/workflows/CI.yml

+38-9
Original file line numberDiff line numberDiff line change
@@ -93,37 +93,66 @@ jobs:
9393
uses: browser-actions/setup-chrome@latest
9494
with:
9595
chrome-version: stable
96-
env:
97-
CHROME_FLAGS: "--enable-features=SharedArrayBuffer,CrossOriginIsolation --enable-experimental-web-platform-features --cross-origin-isolated --allow-file-access-from-files --disable-web-security --allow-insecure-localhost --no-sandbox --disable-setuid-sandbox --enable-unsafe-webgpu --disable-gpu-sandbox"
9896
- name: Run tests
9997
env:
10098
CHROME_HEADLESS: 1
10199
CHROME_PATH: chrome
100+
CHROME_FLAGS: "--enable-features=SharedArrayBuffer --headless --disable-gpu --no-sandbox --enable-experimental-web-platform-features --enable-features=SharedArrayBuffer"
102101
HEADERS: '{"Cross-Origin-Opener-Policy": "same-origin", "Cross-Origin-Embedder-Policy": "require-corp", "Cross-Origin-Resource-Policy": "cross-origin", "Origin-Agent-Cluster": "?1"}'
103102
run: |
104103
# Start test server with proper headers for all tests
105104
npm run serve &
106105
107-
# Wait for server to start
108-
sleep 5
106+
# Wait for server to start and ensure headers are properly set
107+
sleep 10
108+
109+
# Verify headers are set correctly
110+
echo "Checking security headers..."
111+
curl -I http://localhost:3000/tests/ffmpeg-core-st.test.html
112+
113+
# Check if cross-origin isolation is working
114+
echo "Adding debug script to test files to check crossOriginIsolated status..."
115+
for test_file in tests/ffmpeg-*.test.html; do
116+
sed -i '/<\/head>/ i\<script>console.log("crossOriginIsolated status:", crossOriginIsolated);</script>' $test_file
117+
done
109118
110-
# Run all tests with proper headers
119+
# Run single-threaded tests first
120+
echo "Running single-threaded tests..."
111121
npx mocha-headless-chrome \
112122
--args="$CHROME_FLAGS" \
113123
-a no-sandbox \
114-
-f http://localhost:3000/tests/ffmpeg-core-mt.test.html
124+
-f http://localhost:3000/tests/ffmpeg-core-st.test.html 2>&1 | tee st-core-test.log
115125
116126
npx mocha-headless-chrome \
117127
--args="$CHROME_FLAGS" \
118128
-a no-sandbox \
119-
-f http://localhost:3000/tests/ffmpeg-core-st.test.html
129+
-f http://localhost:3000/tests/ffmpeg-st.test.html 2>&1 | tee st-test.log
130+
131+
# Run multi-threaded tests with additional SharedArrayBuffer flags
132+
echo "Running multi-threaded tests..."
133+
CHROME_FLAGS="$CHROME_FLAGS --enable-features=SharedArrayBuffer,CrossOriginIsolation --cross-origin-isolated"
134+
135+
# Debug SharedArrayBuffer availability
136+
echo "Testing SharedArrayBuffer availability..."
137+
cat << EOF > debug-sab.js
138+
console.log('SharedArrayBuffer available:', typeof SharedArrayBuffer !== 'undefined');
139+
console.log('crossOriginIsolated:', crossOriginIsolated);
140+
EOF
141+
node debug-sab.js
120142
121143
npx mocha-headless-chrome \
122144
--args="$CHROME_FLAGS" \
123145
-a no-sandbox \
124-
-f http://localhost:3000/tests/ffmpeg-mt.test.html
146+
-f http://localhost:3000/tests/ffmpeg-core-mt.test.html 2>&1 | tee mt-core-test.log
125147
126148
npx mocha-headless-chrome \
127149
--args="$CHROME_FLAGS" \
128150
-a no-sandbox \
129-
-f http://localhost:3000/tests/ffmpeg-st.test.html
151+
-f http://localhost:3000/tests/ffmpeg-mt.test.html 2>&1 | tee mt-test.log
152+
153+
# Display all logs for debugging
154+
echo "=== Test Logs ==="
155+
for log in *-test.log; do
156+
echo "Contents of $log:"
157+
cat $log
158+
done

0 commit comments

Comments
 (0)