-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests_matrix.sh
More file actions
executable file
·72 lines (59 loc) · 2.11 KB
/
run_tests_matrix.sh
File metadata and controls
executable file
·72 lines (59 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Lua bitN Library - Test Matrix Runner
# Runs tests across multiple Lua versions using luaenv
#
# Usage: ./run_tests_matrix.sh [module_names...]
#
# Examples:
# ./run_tests_matrix.sh # Run all tests on all versions
# ./run_tests_matrix.sh bit32 # Run bit32 tests on all versions
# ./run_tests_matrix.sh bit32 bit64 # Run specific tests on all versions
# List of luaenv versions to test
LUA_VERSIONS=("5.1.5" "5.2.4" "5.3.6" "5.4.8" "luajit-2.1-dev")
# Colors for output
green='\033[0;32m'
yellow='\033[1;33m'
red='\033[0;31m'
nc='\033[0m' # No Color
luaenv_binary="${LUAENV_BINARY:-luaenv}"
# Get script directory
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
if ! command -v "$luaenv_binary" &> /dev/null; then
echo -e "${red}❌ Error: $luaenv_binary command not found.${nc}"
exit 1
fi
if [ ! -d "$($luaenv_binary prefix)/../../plugins/luaenv-luarocks" ]; then
echo -e "${red}❌ Error: luaenv-luarocks plugin not found. Please install it first.${nc}"
exit 1
fi
# Track overall results
failed_versions=()
passed_versions=()
for lua_version in "${LUA_VERSIONS[@]}"; do
echo -e "${yellow}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~${nc}"
echo -e "${yellow}Running tests with $lua_version${nc}"
echo -e "${yellow}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~${nc}"
echo
"$luaenv_binary" install -s $lua_version
lua_prefix="$($luaenv_binary prefix $lua_version)"
lua_binary="$lua_prefix/bin/lua"
# Run the tests and pass all arguments
if ! LUA_BINARY="$lua_binary" "$script_dir/run_tests.sh" "$@"; then
failed_versions+=("$lua_version")
else
passed_versions+=("$lua_version")
fi
done
# Final summary
echo "============================================="
echo "📊 Matrix Test Summary"
echo "============================================="
if [ ${#failed_versions[@]} -eq 0 ]; then
echo -e "${green}✅ All LUA VERSIONS PASSED:${nc}"
printf '%s\n' "${passed_versions[@]}"
exit 0
else
echo -e "${red}💥 SOME LUA VERSIONS FAILED:${nc}"
printf '%s\n' "${failed_versions[@]}"
exit 1
fi