Skip to content

Instantly share code, notes, and snippets.

@Phineas1500
Last active July 16, 2025 15:31
Show Gist options
  • Save Phineas1500/76e92ddd228fea2306a47cff7bb4f317 to your computer and use it in GitHub Desktop.
Save Phineas1500/76e92ddd228fea2306a47cff7bb4f317 to your computer and use it in GitHub Desktop.
#!/bin/bash
# 32-bit iSH Test Script
# Tests various 32-bit functionality to ensure compatibility
echo "========================================="
echo "32-bit iSH Functionality Test"
echo "========================================="
# Step 1: Clean rebuild
echo "Step 1: Clean rebuild..."
rm -rf build/
meson setup build
ninja -C build
echo ""
echo "========================================="
echo "Running 32-bit Tests"
echo "========================================="
# Initialize test result arrays
declare -a test_names
declare -a test_results
# Test 1: Basic echo test
echo ""
echo "Test 1: Basic echo test"
echo "Command: ./build/ish -f alpine-32bit-processed /bin/busybox echo \"32-bit ok\""
echo "Expected: Should output '32-bit ok' and exit with code 0"
echo "---"
./build/ish -f alpine-32bit-processed /bin/busybox echo "32-bit ok" && echo "32 exit:$?"
test_exit_code=$?
test_names[0]="Test 1: Basic echo test"
if [ $test_exit_code -eq 0 ]; then
test_results[0]="PASSED"
else
test_results[0]="FAILED"
fi
echo "Test 1 completed."
# Test 2: Shell test
echo ""
echo "Test 2: Shell test"
echo "Command: ./build/ish -f alpine-32bit-processed /bin/sh -c \"echo 'Shell test passed'\""
echo "Expected: Should output 'Shell test passed'"
echo "---"
./build/ish -f alpine-32bit-processed /bin/sh -c "echo 'Shell test passed'"
test_exit_code=$?
test_names[1]="Test 2: Shell test"
if [ $test_exit_code -eq 0 ]; then
test_results[1]="PASSED"
else
test_results[1]="FAILED"
fi
echo "Test 2 completed."
# Test 3: List directory
echo ""
echo "Test 3: List directory"
echo "Command: ./build/ish -f alpine-32bit-processed /bin/busybox ls"
echo "Expected: Should list directory contents"
echo "---"
./build/ish -f alpine-32bit-processed /bin/busybox ls
test_exit_code=$?
test_names[2]="Test 3: List directory"
if [ $test_exit_code -eq 0 ]; then
test_results[2]="PASSED"
else
test_results[2]="FAILED"
fi
echo "Test 3 completed."
# Test 4: Help command
echo ""
echo "Test 4: Help command"
echo "Command: ./build/ish -f alpine-32bit-processed /bin/busybox --help"
echo "Expected: Should display busybox help"
echo "---"
./build/ish -f alpine-32bit-processed /bin/busybox --help
test_exit_code=$?
test_names[3]="Test 4: Help command"
if [ $test_exit_code -eq 0 ]; then
test_results[3]="PASSED"
else
test_results[3]="FAILED"
fi
echo "Test 4 completed."
# Test 5: Whoami command
echo ""
echo "Test 5: Whoami command"
echo "Command: ./build/ish -f alpine-32bit-processed /bin/busybox whoami"
echo "Expected: Should display current user"
echo "---"
./build/ish -f alpine-32bit-processed /bin/busybox whoami
test_exit_code=$?
test_names[4]="Test 5: Whoami command"
if [ $test_exit_code -eq 0 ]; then
test_results[4]="PASSED"
else
test_results[4]="FAILED"
fi
echo "Test 5 completed."
# Test 6: PWD command
echo ""
echo "Test 6: PWD command"
echo "Command: ./build/ish -f alpine-32bit-processed /bin/busybox pwd"
echo "Expected: Should display current directory"
echo "---"
./build/ish -f alpine-32bit-processed /bin/busybox pwd
test_exit_code=$?
test_names[5]="Test 6: PWD command"
if [ $test_exit_code -eq 0 ]; then
test_results[5]="PASSED"
else
test_results[5]="FAILED"
fi
echo "Test 6 completed."
echo ""
echo "========================================="
echo "TEST RESULTS SUMMARY"
echo "========================================="
# Count passed and failed tests
passed_count=0
failed_count=0
# Display individual test results
for i in {0..5}; do
if [ "${test_results[i]}" == "PASSED" ]; then
echo "✅ ${test_names[i]}: ${test_results[i]}"
((passed_count++))
else
echo "❌ ${test_names[i]}: ${test_results[i]}"
((failed_count++))
fi
done
echo ""
echo "========================================="
echo "OVERALL SUMMARY"
echo "========================================="
echo "Total tests: 6"
echo "Passed: $passed_count"
echo "Failed: $failed_count"
if [ $failed_count -eq 0 ]; then
echo "🎉 All tests PASSED! 32-bit functionality is working correctly."
else
echo "⚠️ Some tests FAILED. 32-bit functionality has issues that need investigation."
fi
echo "========================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment