Skip to content

Commit

Permalink
Continued
Browse files Browse the repository at this point in the history
  • Loading branch information
mutagene committed Nov 25, 2023
1 parent 28e2f71 commit 9f679e0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,19 @@ jobs:
uses: py-actions/py-dependency-install@v3
with:
path: "requirements.txt"
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 20.9.0
- name: Install browserify
run: npm install -g browserify
- name: Setup EMSDK
uses: mymindstorm/setup-emsdk@v11
with:
version: 3.1.44
- name: Use local djinni djinni
- name: Install chrome
uses: browser-actions/setup-chrome@latest
- name: Use local djinni on branch for now
if: ${{ github.ref != 'refs/heads/master' }}
run: export CMAKE_DJINNI_OPT="-DDJINNI_EXECUTABLE=$(pwd)/bin/djinni"
- name: Report cmake version
Expand All @@ -145,7 +153,8 @@ jobs:
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
- name: Build release
run: cmake --build build --parallel $(nproc) --config Release

- name: Run headless test
run: pushd build && ctest --output-on-failure

build-on-windows-for-cppcli:
runs-on: windows-latest
Expand Down
2 changes: 0 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ if(DJINNI_WITH_WASM)
)

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

string(JOIN " " EMSCRIPTEN_LINK_OPTIONS
Expand All @@ -83,7 +82,6 @@ if(DJINNI_WITH_WASM)
)

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

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cffi==1.14.5
future==0.18.2
pytest==6.2.5
selenium==4.15.2
2 changes: 0 additions & 2 deletions test-suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ if(DJINNI_WITH_WASM)
)

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

string(JOIN " " EMSCRIPTEN_LINK_OPTIONS
Expand All @@ -252,7 +251,6 @@ if(DJINNI_WITH_WASM)
)

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

Expand Down
13 changes: 8 additions & 5 deletions test-suite/handwritten-src/ts/run-tests-selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import threading

port = 8089
port = "8080"
httpd = HTTPServer(("127.0.0.1", int(port)), SimpleHTTPRequestHandler)

def run_server():
Expand All @@ -19,16 +19,19 @@ def run_server():

service = Service(executable_path=r'/usr/bin/chromedriver')
options = webdriver.ChromeOptions()
#options.add_argument('--headless')
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(service=service, options=options)
print(f"connecting web driver to http://localhost:{port}/")
driver.get(f"http://localhost:{port}/test.html")
#element = driver.find_element(By.NAME, "query")
#assert element.is_enabled()
failed_elements = driver.find_elements(By.XPATH, "//pre[@id='output']/span[contains(text(), 'FAILED')]")
for element in failed_elements:
print(f"{element.text}", file=sys.stderr)
driver.quit()
finished_tests = True
httpd.shutdown()
server_thread.join()
if len(failed_elements) > 0:
exit(1)
exit(0)
8 changes: 6 additions & 2 deletions test-suite/handwritten-src/ts/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#! /usr/bin/env bash
#! /usr/bin/env bash
set -eu
# compile TS
tsc
# bundle
browserify main.js -o bundle.js
sleep 1 && python3 -mwebbrowser http://localhost:8000/test.html &
python3 -m http.server
# then run the selenium tests
sleep 1 && python3 run-tests-selenium.py

0 comments on commit 9f679e0

Please sign in to comment.