Fix failing unit tests in GitHub Actions matrix
- Clojure: Use 'clojure' instead of 'clj -M' for standalone script - Dart: Add proper pubspec.yaml with SDK environment constraint - Julia: Install SHA package before running tests - Lua: Use lua5.4 explicitly, add awk for portable HMAC output parsing - Perl: Install libjson-perl and libwww-perl dependencies - Bash: Make un.sh executable before test - OCaml: Add str.cma and unix.cma for Str module support - OCaml unit test: Remove Str dependency with pure string search
This commit is contained in:
parent
d095008e8c
commit
a1eedc55ea
3 changed files with 32 additions and 14 deletions
33
.github/workflows/inception-matrix.yml
vendored
33
.github/workflows/inception-matrix.yml
vendored
|
|
@ -57,10 +57,10 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Lua
|
- name: Install Lua and OpenSSL
|
||||||
run: sudo apt-get update && sudo apt-get install -y lua5.4
|
run: sudo apt-get update && sudo apt-get install -y lua5.4 openssl
|
||||||
- name: Run Lua unit tests
|
- name: Run Lua unit tests
|
||||||
run: lua tests/unit/test_lua.lua
|
run: lua5.4 tests/unit/test_lua.lua
|
||||||
|
|
||||||
unit-tests-php:
|
unit-tests-php:
|
||||||
name: "Unit: PHP"
|
name: "Unit: PHP"
|
||||||
|
|
@ -112,6 +112,8 @@ jobs:
|
||||||
- uses: julia-actions/setup-julia@v1
|
- uses: julia-actions/setup-julia@v1
|
||||||
with:
|
with:
|
||||||
version: '1'
|
version: '1'
|
||||||
|
- name: Install Julia packages
|
||||||
|
run: julia -e 'using Pkg; Pkg.add("SHA")'
|
||||||
- name: Run Julia unit tests
|
- name: Run Julia unit tests
|
||||||
run: julia tests/unit/test_julia.jl
|
run: julia tests/unit/test_julia.jl
|
||||||
|
|
||||||
|
|
@ -137,7 +139,7 @@ jobs:
|
||||||
chmod +x linux-install.sh
|
chmod +x linux-install.sh
|
||||||
sudo ./linux-install.sh
|
sudo ./linux-install.sh
|
||||||
- name: Run Clojure unit tests
|
- name: Run Clojure unit tests
|
||||||
run: clj -M tests/unit/test_clojure.clj
|
run: clojure tests/unit/test_clojure.clj
|
||||||
|
|
||||||
unit-tests-dart:
|
unit-tests-dart:
|
||||||
name: "Unit: Dart"
|
name: "Unit: Dart"
|
||||||
|
|
@ -148,12 +150,16 @@ jobs:
|
||||||
- name: Install crypto package
|
- name: Install crypto package
|
||||||
run: |
|
run: |
|
||||||
cd tests/unit
|
cd tests/unit
|
||||||
echo 'name: test_dart' > pubspec.yaml
|
cat > pubspec.yaml << 'EOF'
|
||||||
echo 'dependencies:' >> pubspec.yaml
|
name: test_dart
|
||||||
echo ' crypto: ^3.0.0' >> pubspec.yaml
|
environment:
|
||||||
|
sdk: '>=3.0.0 <4.0.0'
|
||||||
|
dependencies:
|
||||||
|
crypto: ^3.0.0
|
||||||
|
EOF
|
||||||
dart pub get
|
dart pub get
|
||||||
- name: Run Dart unit tests
|
- name: Run Dart unit tests
|
||||||
run: cd tests/unit && dart run test_dart.dart
|
run: cd tests/unit && dart test_dart.dart
|
||||||
|
|
||||||
unit-tests-tcl:
|
unit-tests-tcl:
|
||||||
name: "Unit: TCL"
|
name: "Unit: TCL"
|
||||||
|
|
@ -199,26 +205,35 @@ jobs:
|
||||||
file: un.py
|
file: un.py
|
||||||
test: tests/test_un_py.py
|
test: tests/test_un_py.py
|
||||||
run: python3 $TEST
|
run: python3 $TEST
|
||||||
|
setup: ""
|
||||||
- lang: JavaScript
|
- lang: JavaScript
|
||||||
file: un.js
|
file: un.js
|
||||||
test: tests/test_un_js.js
|
test: tests/test_un_js.js
|
||||||
run: node $TEST
|
run: node $TEST
|
||||||
|
setup: ""
|
||||||
- lang: Ruby
|
- lang: Ruby
|
||||||
file: un.rb
|
file: un.rb
|
||||||
test: tests/test_un_rb.rb
|
test: tests/test_un_rb.rb
|
||||||
run: ruby $TEST
|
run: ruby $TEST
|
||||||
|
setup: ""
|
||||||
- lang: Perl
|
- lang: Perl
|
||||||
file: un.pl
|
file: un.pl
|
||||||
test: tests/test_un_pl.pl
|
test: tests/test_un_pl.pl
|
||||||
run: perl $TEST
|
run: perl $TEST
|
||||||
|
setup: "sudo apt-get update && sudo apt-get install -y libjson-perl libwww-perl"
|
||||||
- lang: Bash
|
- lang: Bash
|
||||||
file: un.sh
|
file: un.sh
|
||||||
test: tests/test_un_sh.sh
|
test: tests/test_un_sh.sh
|
||||||
run: bash $TEST
|
run: bash $TEST
|
||||||
|
setup: "chmod +x un.sh"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup dependencies
|
||||||
|
if: matrix.setup != ''
|
||||||
|
run: ${{ matrix.setup }}
|
||||||
|
|
||||||
- name: Run ${{ matrix.lang }} tests
|
- name: Run ${{ matrix.lang }} tests
|
||||||
env:
|
env:
|
||||||
TEST: ${{ matrix.test }}
|
TEST: ${{ matrix.test }}
|
||||||
|
|
@ -562,7 +577,7 @@ jobs:
|
||||||
- name: Run OCaml tests
|
- name: Run OCaml tests
|
||||||
run: |
|
run: |
|
||||||
eval $(opam env)
|
eval $(opam env)
|
||||||
ocaml tests/test_un_ml.ml || true
|
ocaml str.cma unix.cma tests/test_un_ml.ml || true
|
||||||
- name: Integration test
|
- name: Integration test
|
||||||
if: env.UNSANDBOX_PUBLIC_KEY != ''
|
if: env.UNSANDBOX_PUBLIC_KEY != ''
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,8 @@ end)
|
||||||
print("\n=== HMAC Signature Tests ===")
|
print("\n=== HMAC Signature Tests ===")
|
||||||
|
|
||||||
local function hmac_sha256(secret, message)
|
local function hmac_sha256(secret, message)
|
||||||
local cmd = string.format("echo -n '%s' | openssl dgst -sha256 -hmac '%s' 2>/dev/null | sed 's/^.* //'",
|
-- Use printf for better portability and awk to extract just the hash
|
||||||
|
local cmd = string.format("printf '%%s' '%s' | openssl dgst -sha256 -hmac '%s' | awk '{print $NF}'",
|
||||||
message:gsub("'", "'\\''"), secret:gsub("'", "'\\''"))
|
message:gsub("'", "'\\''"), secret:gsub("'", "'\\''"))
|
||||||
local handle = io.popen(cmd)
|
local handle = io.popen(cmd)
|
||||||
if handle then
|
if handle then
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,12 @@ let starts_with prefix str =
|
||||||
String.length str >= plen && String.sub str 0 plen = prefix
|
String.length str >= plen && String.sub str 0 plen = prefix
|
||||||
|
|
||||||
let contains haystack needle =
|
let contains haystack needle =
|
||||||
try
|
let rec search i =
|
||||||
let _ = Str.search_forward (Str.regexp_string needle) haystack 0 in
|
if i + String.length needle > String.length haystack then false
|
||||||
true
|
else if String.sub haystack i (String.length needle) = needle then true
|
||||||
with Not_found -> false
|
else search (i + 1)
|
||||||
|
in
|
||||||
|
search 0
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
print_endline "\n=== Extension Mapping Tests ===";
|
print_endline "\n=== Extension Mapping Tests ===";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue