-
Notifications
You must be signed in to change notification settings - Fork 0
ci: Add unit testing for wasm variant #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive unit testing for the WebAssembly variant of the unoicu library. It introduces a validation framework that tests the compiled unoicu.a artifacts using headless Chromium via Puppeteer to ensure the ICU library functions correctly in a browser environment.
Changes:
- Added validation test harness (C program and JavaScript test runner) to validate unoicu.a artifacts
- Expanded CI build matrix to include multithreaded and SIMD variants (4 combinations: mt/st × simd/nosimd)
- Enhanced Dockerfile with cross-compilation support and build configuration for threading/SIMD
- Added new
validate_unoicujob in CI pipeline to test artifacts before packaging
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/unoicu/validation/run-test.js | New Puppeteer-based test runner that launches headless Chrome to validate the WASM module |
| src/unoicu/validation/main.c | New C test harness that exercises ICU string conversion functions and reports results to JavaScript |
| src/unoicu/validation/README.md | Documentation explaining the validation harness and its purpose |
| src/unoicu/Dockerfile | Enhanced with cross-compilation support, pkgdata patch, multithreading/SIMD build arguments, and typo fix ("currect" → "current") |
| .github/workflows/main.yml | Expanded build matrix, added validate_unoicu job, updated artifact handling to support multiple configurations, and added package job dependency on validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| shopt -s nullglob | ||
| for dir in unoicu-*; do | ||
| new_name="${dir#unoicu-}" | ||
| mkdir -p ../nuget/uno.icu-wasm/buildTransitive/native/unoicu.a/"$new_name"/st | ||
| cp -r "$dir"/unoicu.a ../nuget/uno.icu-wasm/buildTransitive/native/unoicu.a/"$new_name"/st/unoicu.a | ||
| SRC_BASE="$dir/unoicu.a" | ||
| if [ ! -d "$SRC_BASE" ]; then | ||
| SRC_BASE="$dir" | ||
| fi | ||
| find "$SRC_BASE" -mindepth 1 -maxdepth 1 -type d ! -name '*nosimd*' -print0 | while IFS= read -r -d '' version_dir; do | ||
| cp -R "$version_dir" ../nuget/uno.icu-wasm/buildTransitive/native/unoicu.a/ | ||
| done | ||
| done |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The artifact handling logic is complex with conditional path handling and nosimd filtering in two places (line 289 and 293). Consider documenting why nosimd variants are being excluded from the package, or extracting this logic into a more explicit and maintainable structure.
| SIMD_SUFFIX=$([ "${{ matrix.simd }}" = 'true' ] && echo ',simd' || echo '') | ||
| TEMP_SIMD_TAG=$([ "${{ matrix.simd }}" = 'true' ] && echo 'simd' || echo 'nosimd') | ||
| TEMP_OUTPUT="out/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}-${TEMP_SIMD_TAG}" | ||
| mkdir -p "${TEMP_OUTPUT}" | ||
| docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --build-arg IS_MULTITHREADED=${{ matrix.multithreaded }} --build-arg IS_SIMD_SUPPORTED=${{ matrix.simd }} --output type=local,dest=${TEMP_OUTPUT} . | ||
| FINAL_DIR="out/unoicu.a/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}${SIMD_SUFFIX}" |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name 'SIMD_SUFFIX' is misleading as it contains a comma prefix ',simd' (line 27) rather than a true suffix. Consider renaming to 'SIMD_PATH_COMPONENT' or 'SIMD_VARIANT' to better reflect its use in path construction.
| SIMD_SUFFIX=$([ "${{ matrix.simd }}" = 'true' ] && echo ',simd' || echo '') | |
| TEMP_SIMD_TAG=$([ "${{ matrix.simd }}" = 'true' ] && echo 'simd' || echo 'nosimd') | |
| TEMP_OUTPUT="out/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}-${TEMP_SIMD_TAG}" | |
| mkdir -p "${TEMP_OUTPUT}" | |
| docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --build-arg IS_MULTITHREADED=${{ matrix.multithreaded }} --build-arg IS_SIMD_SUPPORTED=${{ matrix.simd }} --output type=local,dest=${TEMP_OUTPUT} . | |
| FINAL_DIR="out/unoicu.a/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}${SIMD_SUFFIX}" | |
| SIMD_PATH_COMPONENT=$([ "${{ matrix.simd }}" = 'true' ] && echo ',simd' || echo '') | |
| TEMP_SIMD_TAG=$([ "${{ matrix.simd }}" = 'true' ] && echo 'simd' || echo 'nosimd') | |
| TEMP_OUTPUT="out/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}-${TEMP_SIMD_TAG}" | |
| mkdir -p "${TEMP_OUTPUT}" | |
| docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --build-arg IS_MULTITHREADED=${{ matrix.multithreaded }} --build-arg IS_SIMD_SUPPORTED=${{ matrix.simd }} --output type=local,dest=${TEMP_OUTPUT} . | |
| FINAL_DIR="out/unoicu.a/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}${SIMD_PATH_COMPONENT}" |
| SIMD_SUFFIX=$([ "${{ matrix.simd }}" = 'true' ] && echo ',simd' || echo '') | ||
| TEMP_SIMD_TAG=$([ "${{ matrix.simd }}" = 'true' ] && echo 'simd' || echo 'nosimd') | ||
| TEMP_OUTPUT="out/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}-${TEMP_SIMD_TAG}" | ||
| mkdir -p "${TEMP_OUTPUT}" | ||
| docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --build-arg IS_MULTITHREADED=${{ matrix.multithreaded }} --build-arg IS_SIMD_SUPPORTED=${{ matrix.simd }} --output type=local,dest=${TEMP_OUTPUT} . | ||
| FINAL_DIR="out/unoicu.a/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}${SIMD_SUFFIX}" |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name 'SIMD_SUFFIX' is misleading as it contains a comma prefix ',simd' (line 27) rather than a true suffix. Consider renaming to 'SIMD_PATH_COMPONENT' or 'SIMD_VARIANT' to better reflect its use in path construction.
| SIMD_SUFFIX=$([ "${{ matrix.simd }}" = 'true' ] && echo ',simd' || echo '') | |
| TEMP_SIMD_TAG=$([ "${{ matrix.simd }}" = 'true' ] && echo 'simd' || echo 'nosimd') | |
| TEMP_OUTPUT="out/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}-${TEMP_SIMD_TAG}" | |
| mkdir -p "${TEMP_OUTPUT}" | |
| docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --build-arg IS_MULTITHREADED=${{ matrix.multithreaded }} --build-arg IS_SIMD_SUPPORTED=${{ matrix.simd }} --output type=local,dest=${TEMP_OUTPUT} . | |
| FINAL_DIR="out/unoicu.a/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}${SIMD_SUFFIX}" | |
| SIMD_PATH_COMPONENT=$([ "${{ matrix.simd }}" = 'true' ] && echo ',simd' || echo '') | |
| TEMP_SIMD_TAG=$([ "${{ matrix.simd }}" = 'true' ] && echo 'simd' || echo 'nosimd') | |
| TEMP_OUTPUT="out/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}-${TEMP_SIMD_TAG}" | |
| mkdir -p "${TEMP_OUTPUT}" | |
| docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --build-arg IS_MULTITHREADED=${{ matrix.multithreaded }} --build-arg IS_SIMD_SUPPORTED=${{ matrix.simd }} --output type=local,dest=${TEMP_OUTPUT} . | |
| FINAL_DIR="out/unoicu.a/${{ matrix.EMSCRIPTEN_VERSION }}/${FEATURE_DIR}${SIMD_PATH_COMPONENT}" |
8066c26 to
6bce77c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| docker run --rm -v "$PWD":/src -w /src/validation/app emscripten/emsdk:${{ matrix.EMSCRIPTEN_VERSION }} \ | ||
| emcc main.c ./unoicu.a \ | ||
| -I"/src/${ICU_SOURCE_SUBPATH}/common" \ | ||
| -I"/src/${ICU_SOURCE_SUBPATH}/i18n" \ | ||
| -sALLOW_MEMORY_GROWTH=1 \ | ||
| -sEXIT_RUNTIME=1 \ | ||
| -sASSERTIONS=1 \ | ||
| -o unoicu_test.html |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation wasm compilation step does not use the same compilation flags (pthread and msimd128) that were used to build the unoicu.a archive being tested. When the archive is built with IS_MULTITHREADED=true, it includes -pthread flag, and when IS_SIMD_SUPPORTED=true, it includes -msimd128 flag. The validation test should use matching flags when compiling against the archive to ensure proper linking and functionality. Add conditional flags based on the matrix parameters to the emcc command.
|
|
||
|
|
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra blank line here. Consider removing one of the blank lines to maintain consistent spacing throughout the file.
No description provided.