Skip to content

Commit 55c93cd

Browse files
mcbartonvgvassilev
authored andcommitted
Add support for running browser tests in Chromium and Firefox on Windows
1 parent f65f80a commit 55c93cd

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

.github/workflows/emscripten.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,23 @@ jobs:
817817
..\
818818
}
819819
emmake make -j ${{ env.ncpus }} check-cppinterop
820+
cd .\unittests\CppInterOp\
821+
Invoke-WebRequest -Uri "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/1411573/chrome-win.zip" -OutFile "$PWD\chrome-win.zip" -Verbose
822+
Expand-Archive -Path "$PWD\chrome-win.zip" -DestinationPath "$PWD" -Force -Verbose
823+
Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US" -OutFile "firefox-setup.exe" -Verbose
824+
& "C:\Program Files\7-Zip\7z.exe" x "firefox-setup.exe"
825+
$env:PATH="$PWD\core;$PWD\chrome-win;$env:PATH"
826+
echo "PATH=$env:PATH"
827+
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
828+
echo "Running CppInterOpTests in Firefox"
829+
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
830+
echo "Running DynamicLibraryManagerTests in Firefox"
831+
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
832+
echo "Running CppInterOpTests in Chromium"
833+
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
834+
echo "Running DynamicLibraryManagerTests in Chromium"
835+
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
836+
cd ..\..
820837
emmake make -j ${{ env.ncpus }} install
821838
822839
- name: Build and Test/Install CppInterOp on Windows systems (static library)
@@ -899,6 +916,15 @@ jobs:
899916
..\
900917
}
901918
emmake make -j ${{ env.ncpus }} check-cppinterop
919+
cd .\unittests\CppInterOp\
920+
echo "Running CppInterOpTests in Firefox"
921+
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
922+
echo "Running DynamicLibraryManagerTests in Firefox"
923+
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
924+
echo "Running CppInterOpTests in Chromium"
925+
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
926+
echo "Running DynamicLibraryManagerTests in Chromium"
927+
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
902928
903929
- name: Build xeus-cpp
904930
if: ${{ runner.os != 'windows' }}

Emscripten-build-instructions.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ emcmake cmake -DCMAKE_BUILD_TYPE=Release `
208208
emmake make -j $(nproc --all) check-cppinterop
209209
```
210210

211-
It is possible to run the Emscripten tests in a headless browser on Linux and osx (in future we plan to include instructions on how to run the tests in a browser on Windows too). To do this we will first move to the tests directory
211+
It is possible to run the Emscripten tests in a headless browser. To do this we will first move to the tests directory
212212

213213

214214
```bash
@@ -283,6 +283,26 @@ echo "Running DynamicLibraryManagerTests in Firefox"
283283
emrun --browser="firefox" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
284284
```
285285

286+
To do this on Windows x86 execute the following
287+
288+
```powershell
289+
Invoke-WebRequest -Uri "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/1411573/chrome-win.zip" -OutFile "$PWD\chrome-win.zip" -Verbose
290+
Expand-Archive -Path "$PWD\chrome-win.zip" -DestinationPath "$PWD" -Force -Verbose
291+
Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US" -OutFile "firefox-setup.exe" -Verbose
292+
& "C:\Program Files\7-Zip\7z.exe" x "firefox-setup.exe"
293+
$env:PATH="$PWD\core;$PWD\chrome-win;$env:PATH"
294+
echo "PATH=$env:PATH"
295+
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
296+
echo "Running CppInterOpTests in Firefox"
297+
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
298+
echo "Running DynamicLibraryManagerTests in Firefox"
299+
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
300+
echo "Running CppInterOpTests in Chromium"
301+
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
302+
echo "Running DynamicLibraryManagerTests in Chromium"
303+
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
304+
```
305+
286306
Assuming it passes all test you can install by executing the following
287307

288308
```bash

docs/Emscripten-build-instructions.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ To build and test your Emscripten build of CppInterOp on Windows execute the fol
232232
..\
233233
emmake make -j $(nproc --all) check-cppinterop
234234
235-
It is possible to run the Emscripten tests in a headless browser on Linux and osx (in future we plan to include instructions on how to run the tests in a browser on Windows too). To do this we will first move to the tests directory
235+
It is possible to run the Emscripten tests in a headless browser. To do this we will first move to the tests directory
236236

237237
.. code:: bash
238238
@@ -306,6 +306,24 @@ so we currently only run the tests using Firefox on this platform, unlike other
306306
echo "Running DynamicLibraryManagerTests in Firefox"
307307
emrun --browser="firefox" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
308308
309+
To do this on Windows x86 execute the following
310+
311+
.. code:: powershell
312+
313+
Invoke-WebRequest -Uri "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/1411573/chrome-win.zip" -OutFile "$PWD\chrome-win.zip" -Verbose
314+
Expand-Archive -Path "$PWD\chrome-win.zip" -DestinationPath "$PWD" -Force -Verbose
315+
Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US" -OutFile "firefox-setup.exe" -Verbose
316+
& "C:\Program Files\7-Zip\7z.exe" x "firefox-setup.exe"
317+
$env:PATH="$PWD\core;$PWD\chrome-win;$env:PATH"
318+
echo "Running CppInterOpTests in Firefox"
319+
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
320+
echo "Running DynamicLibraryManagerTests in Firefox"
321+
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
322+
echo "Running CppInterOpTests in Chromium"
323+
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
324+
echo "Running DynamicLibraryManagerTests in Chromium"
325+
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
326+
309327
Assuming it passes all test you can install by executing the following.
310328

311329
.. code:: bash

0 commit comments

Comments
 (0)