-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_linux.sh
More file actions
executable file
·76 lines (62 loc) · 1.64 KB
/
test_linux.sh
File metadata and controls
executable file
·76 lines (62 loc) · 1.64 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
73
74
75
76
#!/bin/bash
# Linux 兼容性测试脚本
echo "=== Linux Compatibility Test ==="
# 检测系统信息
echo "System Information:"
echo "OS: $(uname -s)"
echo "Architecture: $(uname -m)"
echo "Kernel: $(uname -r)"
if [[ -f /etc/os-release ]]; then
echo "Distribution:"
cat /etc/os-release | grep -E "^(NAME|VERSION)="
fi
echo ""
# 检查编译器
echo "Compiler Information:"
if command -v gcc &> /dev/null; then
echo "GCC: $(gcc --version | head -n1)"
else
echo "GCC: Not found"
fi
if command -v g++ &> /dev/null; then
echo "G++: $(g++ --version | head -n1)"
else
echo "G++: Not found"
fi
echo ""
# 检查 CMake
echo "CMake Information:"
if command -v cmake &> /dev/null; then
echo "CMake: $(cmake --version | head -n1)"
else
echo "CMake: Not found"
fi
echo ""
# 检查动态链接器
echo "Dynamic Linker Information:"
if command -v ldd &> /dev/null; then
echo "ldd: $(ldd --version 2>/dev/null | head -n1 || echo 'ldd found but version unknown')"
else
echo "ldd: Not found"
fi
echo ""
# 检查必要的库
echo "Library Check:"
if [[ -f /usr/lib/x86_64-linux-gnu/libdl.so ]] || [[ -f /lib/x86_64-linux-gnu/libdl.so ]] || [[ -f /usr/lib64/libdl.so ]]; then
echo "libdl: Found"
else
echo "libdl: Not found (this may cause issues)"
fi
echo ""
# 运行构建测试
echo "Running build test..."
if ./build_and_run.sh; then
echo ""
echo "✅ Linux compatibility test PASSED!"
echo "The project builds and runs successfully on this Linux system."
else
echo ""
echo "❌ Linux compatibility test FAILED!"
echo "Please check the error messages above and install missing dependencies."
exit 1
fi