File size: 1,065 Bytes
d12a6df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# find all tool.py files in the tools folder
tools=$(find . -type f -name "tool.py")

echo "Testing all tools"
echo "Tools:"
for tool in $tools; do
    echo "  - $(basename $(dirname $tool))"
done

echo ""
echo "Running tests in parallel..."

# Export function so parallel can use it
run_test() {
    local tool="$1"
    local tool_dir=$(dirname "$tool")
    local tool_name=$(basename "$tool_dir")

    echo "Testing $tool_name..."

    pushd "$tool_dir" > /dev/null || exit 1

    python tool.py > test.log 2>&1
    exit_code=$?

    if [ $exit_code -ne 0 ]; then
        echo "❌ $tool_name failed! Check $tool_dir/test.log for details" >&2
        exit $exit_code
    else
        echo "✅ $tool_name passed"
    fi

    popd > /dev/null
}
export -f run_test

export tools
# Run all tests in parallel, max 8 at a time
echo "$tools" | tr ' ' '\n' | parallel -j 8 run_test

# Capture overall success/failure
if [ $? -eq 0 ]; then
    echo ""
    echo "✅ All tests passed"
    exit 0
else
    echo ""
    echo "❌ Some tests failed"
    exit 1
fi