diff --git a/.gitignore b/.gitignore index ccf0512..74a65c4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ /undici-*-nm-prod.tgz /undici-*-nm-dev.tgz /undici-*-bundled-licenses.txt + +#untared package folders +/undici* diff --git a/nodejs-undici.spec b/nodejs-undici.spec index 12dde2d..6d99ca2 100644 --- a/nodejs-undici.spec +++ b/nodejs-undici.spec @@ -1,12 +1,20 @@ %global npm_name undici -%global llhttp_version_major 8 -%global llhttp_version_minor 1 +# Note: clang runs wasm-opt automatically if found in $PATH, +# which can cause confusing errors ("bulk memory is disabled"). +# Workaround by disabling the wasm-opt on releases when this manifests. +# Can be fixed by --no-wasm-opt flag, once that lands in released clang: +# https://github.com/llvm/llvm-project/pull/95208 +# Adjust as needed. +%bcond wasm_opt %[0%{?fedora} > 39] + +%global llhttp_version_major 9 +%global llhttp_version_minor 3 %global llhttp_version_patch 0 Name: nodejs-%{npm_name} Summary: An HTTP/1.1 client, written from scratch for Node.js -Version: 6.11.1 +Version: 7.16.0 Release: %autorelease License: MIT @@ -17,6 +25,7 @@ Source1: %{npm_name}-%{version}-nm-prod.tgz Source2: %{npm_name}-%{version}-nm-dev.tgz Source3: %{npm_name}-%{version}-bundled-licenses.txt Source4: %{npm_name}-sources.sh +Source5: test-runner.sh # Binary artifacts in this package are aimed at the wasm32-wasi "architecture". %global _binaries_in_noarch_packages_terminate_build 0 @@ -26,6 +35,9 @@ ExclusiveArch: %{ix86} x86_64 aarch64 ppc64le riscv64 noarch BuildRequires: clang lld wasi-libc-devel BuildRequires: nodejs-devel npm +%if %{with wasm_opt} +BuildRequires: binaryen +%endif # for autosetup -S git_am BuildRequires: git-core @@ -58,6 +70,9 @@ export WASM_CC=clang export WASM_CFLAGS='--target=wasm32-wasi --sysroot=/usr/wasm32-wasi' export WASM_LDFLAGS='-nodefaultlibs' export WASM_LDLIBS='-lc' +%if %{with wasm_opt} +export WASM_OPT=/usr/bin/wasm-opt +%endif # `npm run build` uses docker; invoke the build script directly env EXTERNAL_PATH='%{nodejs_sitelib}/%{npm_name}' %{__nodejs} build/wasm.js @@ -78,8 +93,10 @@ install -p -Dt %{buildroot}%{nodejs_sitelib}/%{npm_name}/ loader.js tar -xzf %{S:2} ln -fsrt node_modules/ node_modules_dev/* ln -fsrt node_modules/.bin/ node_modules_dev/.bin/* -# Depends on the environment/OpenSSL version, etc. Informational only. -npm --offline run test || : + +# Built-in test run using borp. Some tests are ignored on purpose. +# See Source5 aka test-runner.sh for details. +bash %{S:5} || exit %files %doc README.md diff --git a/sources b/sources index a4d405b..c228e69 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (undici-6.11.1-stripped.tar.gz) = 851d95aa77e8ce2c4c7dd73be5989b1e235465e9f122a7b685e0e22a4eab0ccd169a0f01f09891234285f1dd04f4e5c9000ccbe8e68a4bad31c7f7dbf4b7c7a7 -SHA512 (undici-6.11.1-nm-prod.tgz) = f119e8d00db1292e5e79010b15dba703cc39f6e93b9b75d54e7bae7fba0d560308e13c9a7e55e61d86d22aaa03d5110311b37adf6b924c0f727b7922222963e4 -SHA512 (undici-6.11.1-nm-dev.tgz) = c2008ac535dd14945ed9f818351a8653ae03bc35f39956ededff2a757d0bb3ca9d269120eb499ef6f3d3f7b729c183b5612cb7a3fcf010072ff0cc68b3357aba -SHA512 (undici-6.11.1-bundled-licenses.txt) = 3e591adb16e09b1c6fb75eb97a6ac51cd06e0aeae2bd5950a15902346e2c9626cb50203bfd0e15c7e8c98af8f24b81c1ce6617c359e7c0e7d0a6366457c844ba +SHA512 (undici-7.16.0-stripped.tar.gz) = 6ed7e439cc3241089137c9e9e420764cd659337d71c4fbaeec7214df6df31d1d7f0d799215b8ded7dddd7556b80fa5e60b66beeed17136db507d1c0ebd9e354a +SHA512 (undici-7.16.0-nm-prod.tgz) = 53d709c53a27eaca553515246106385c29d27993af969903c14cc6bef26826ea78f84e6b31753ccf06fef0d6e5b5830d53352451e75cc3b68ff51362a3f812ce +SHA512 (undici-7.16.0-nm-dev.tgz) = 0263dcb0ad3e64c8e798e03b4aebb07c265dc03fa538dc58c44fcea818bfbc71928adf38bc1a89696bed699423b30225101ba3f9fb214da177061a8a660813d7 +SHA512 (undici-7.16.0-bundled-licenses.txt) = 3e591adb16e09b1c6fb75eb97a6ac51cd06e0aeae2bd5950a15902346e2c9626cb50203bfd0e15c7e8c98af8f24b81c1ce6617c359e7c0e7d0a6366457c844ba diff --git a/test-runner.sh b/test-runner.sh new file mode 100755 index 0000000..a3d640a --- /dev/null +++ b/test-runner.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -e + +# Comment out for full error trace +declare -a ignored_tests=( + "test/http2.js" # Some issue with custom openSSL engine in nodejs we pack. Error:0A00018F:SSL routines::ee key too small + "test/https.js" # -/- + "test/https2.js" # -/- + "test/connect-pre-shared-session.js" # -/- + "test/h2c-client.js" # -/- + "test/connect-timeout.js" # Nodejs side issue. AssertionError [ERR_ASSERTION]: Failed + "test/pool.js" # @jstanek: fails in Koji, works on my laptop. ¯\_(ツ)_/¯ +) + +# Conditional architecture-specific ignores +ARCH=$(uname -m) + +# Add architecture-specific ignores (when any) +#if [ "$ARCH" == "x86_64" ]; then +# ignored_tests+=("test/arch-specific/x86_64/*.js") # Example: Arch-specific test for x86_64 +#elif [ "$ARCH" == "armv7l" ]; then +# ignored_tests+=("test/arch-specific/armv7l/*.js") # Example: Arch-specific test for armv7l +#fi + +# Run borp command with the ignored tests +echo "Running tests with exclusions..." +IGNORE_ARGS="" +for test in "${ignored_tests[@]}"; do + IGNORE_ARGS="$IGNORE_ARGS --ignore $test" +done + +# Run borp with the specified ignores +exec npx borp --expose-gc -p "test/*.js" $IGNORE_ARGS diff --git a/undici-sources.sh b/undici-sources.sh index 03f114f..f2c38e8 100755 --- a/undici-sources.sh +++ b/undici-sources.sh @@ -57,7 +57,7 @@ nuke_wasm() { # Remove husky (git hook manager) from prepare scripts remove_husky() { cd "${1-undici-v${UNDICI_VERSION}/}" >/dev/null - if grep -q 'husky install' package.json; then + if grep -q 'husky' package.json; then npm pkg delete scripts.prepare fi cd - >/dev/null