Skip to content

Commit 5976b8c

Browse files
committed
Continued
1 parent 28e2f71 commit 5976b8c

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ jobs:
136136
uses: mymindstorm/setup-emsdk@v11
137137
with:
138138
version: 3.1.44
139-
- name: Use local djinni djinni
139+
- name: Install chrome
140+
uses: browser-actions/setup-chrome@latest
141+
- name: Use local djinni on branch for now
140142
if: ${{ github.ref != 'refs/heads/master' }}
141143
run: export CMAKE_DJINNI_OPT="-DDJINNI_EXECUTABLE=$(pwd)/bin/djinni"
142144
- name: Report cmake version
@@ -145,7 +147,12 @@ jobs:
145147
run: cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -S . -B build -DDJINNI_WITH_WASM=ON -DDJINNI_EXECUTABLE=$(pwd)/bin/djinni
146148
- name: Build release
147149
run: cmake --build build --parallel $(nproc) --config Release
148-
150+
- name: Run headless test
151+
uses: coactions/setup-xvfb@v1
152+
with:
153+
run: ctest --output-on-failure
154+
working-directory: build
155+
options: #optional
149156

150157
build-on-windows-for-cppcli:
151158
runs-on: windows-latest

examples/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ if(DJINNI_WITH_WASM)
7171
)
7272

7373
set(WASM_CC_FLAGS "-s MAIN_MODULE=1 -fexceptions")
74-
message(WARNING ${WASM_CC_FLAGS})
7574
set_target_properties(${DjinniTextsortWasm} PROPERTIES COMPILE_FLAGS ${WASM_CC_FLAGS})
7675

7776
string(JOIN " " EMSCRIPTEN_LINK_OPTIONS
@@ -83,7 +82,6 @@ if(DJINNI_WITH_WASM)
8382
)
8483

8584
set(WASM_LINK_FLAGS "${EMSCRIPTEN_LINK_OPTIONS} -fexceptions")
86-
message(WARNING ${WASM_LINK_FLAGS})
8785
set_target_properties(${DjinniTextsortWasm} PROPERTIES LINK_FLAGS ${WASM_LINK_FLAGS})
8886
set(CMAKE_EXECUTABLE_SUFFIX ".js")
8987

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
cffi==1.14.5
22
future==0.18.2
33
pytest==6.2.5
4+
selenium=4.15.2

test-suite/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ if(DJINNI_WITH_WASM)
240240
)
241241

242242
set(WASM_CC_FLAGS "-s MAIN_MODULE=1 -fexceptions")
243-
message(WARNING ${WASM_CC_FLAGS})
244243
set_target_properties(${DjinniWasmTest} PROPERTIES COMPILE_FLAGS ${WASM_CC_FLAGS})
245244

246245
string(JOIN " " EMSCRIPTEN_LINK_OPTIONS
@@ -252,7 +251,6 @@ if(DJINNI_WITH_WASM)
252251
)
253252

254253
set(WASM_LINK_FLAGS "${EMSCRIPTEN_LINK_OPTIONS} -fexceptions")
255-
message(WARNING ${WASM_LINK_FLAGS})
256254
set_target_properties(${DjinniWasmTest} PROPERTIES LINK_FLAGS ${WASM_LINK_FLAGS})
257255
set(CMAKE_EXECUTABLE_SUFFIX ".js")
258256

test-suite/handwritten-src/ts/run-tests-selenium.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import sys
88
import threading
99

10-
port = 8089
10+
port = "8080"
1111
httpd = HTTPServer(("127.0.0.1", int(port)), SimpleHTTPRequestHandler)
1212

1313
def run_server():
@@ -19,16 +19,19 @@ def run_server():
1919

2020
service = Service(executable_path=r'/usr/bin/chromedriver')
2121
options = webdriver.ChromeOptions()
22-
#options.add_argument('--headless')
22+
options.add_argument('--headless')
2323
options.add_argument('--no-sandbox')
2424
options.add_argument('--disable-dev-shm-usage')
2525
options.add_argument('--disable-gpu')
2626
driver = webdriver.Chrome(service=service, options=options)
2727
print(f"connecting web driver to http://localhost:{port}/")
2828
driver.get(f"http://localhost:{port}/test.html")
29-
#element = driver.find_element(By.NAME, "query")
30-
#assert element.is_enabled()
29+
failed_elements = driver.find_elements(By.XPATH, "//pre[@id='output']/span[contains(text(), 'FAILED')]")
30+
for element in failed_elements:
31+
print(f"{element.text}", file=sys.stderr)
3132
driver.quit()
32-
finished_tests = True
3333
httpd.shutdown()
3434
server_thread.join()
35+
if len(failed_elements) > 0:
36+
exit(1)
37+
exit(0)

test-suite/handwritten-src/ts/run.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#! /usr/bin/env bash
2+
#! /usr/bin/env bash
23
set -eu
4+
# compile TS
35
tsc
6+
# bundle
47
browserify main.js -o bundle.js
5-
sleep 1 && python3 -mwebbrowser http://localhost:8000/test.html &
6-
python3 -m http.server
8+
# then run the selenium tests
9+
sleep 1 && python3 run-tests-selenium.py
10+

0 commit comments

Comments
 (0)