-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sh
executable file
·96 lines (76 loc) · 2.3 KB
/
test.sh
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Test configuration
TEST_ITERATIONS=3
DMA_TEST_CHANNELS="0 1 2 3"
echo -e "${YELLOW}Starting WiFi 6E/7 Driver Tests${NC}"
# Build the driver and test modules
echo "Building driver and test modules..."
make clean
make || {
echo -e "${RED}Build failed${NC}"
exit 1
}
# Function to run a test module
run_test() {
local module=$1
local desc=$2
echo -e "\n${YELLOW}Running $desc${NC}"
# Remove module if already loaded
if lsmod | grep -q "^$module"; then
sudo rmmod $module
fi
# Insert module
sudo insmod $module.ko || {
echo -e "${RED}Failed to load $module${NC}"
return 1
}
# Check dmesg for errors
if dmesg | tail -n 50 | grep -i "error\|fail\|warn"; then
echo -e "${RED}Errors detected in dmesg for $module${NC}"
sudo rmmod $module
return 1
fi
# Remove module
sudo rmmod $module || {
echo -e "${RED}Failed to unload $module${NC}"
return 1
}
echo -e "${GREEN}$desc completed successfully${NC}"
return 0
}
# Run band tests
for i in $(seq 1 $TEST_ITERATIONS); do
echo -e "\n${YELLOW}Test Iteration $i/$TEST_ITERATIONS${NC}"
# Run band test
run_test "wifi67_test" "Band Test" || exit 1
# Run DMA tests for each channel
for channel in $DMA_TEST_CHANNELS; do
echo -e "\n${YELLOW}Testing DMA channel $channel${NC}"
sudo insmod dma_test.ko test_channel=$channel || {
echo -e "${RED}Failed to load DMA test module for channel $channel${NC}"
exit 1
}
# Check dmesg for test results
if dmesg | tail -n 50 | grep -i "error\|fail"; then
echo -e "${RED}DMA test failed for channel $channel${NC}"
sudo rmmod dma_test
exit 1
fi
# Print test results
dmesg | tail -n 10 | grep "DMA Test Results"
sudo rmmod dma_test || {
echo -e "${RED}Failed to unload DMA test module${NC}"
exit 1
}
echo -e "${GREEN}DMA test completed successfully for channel $channel${NC}"
done
done
echo -e "\n${GREEN}All tests completed successfully${NC}"
# Clean up
make clean
exit 0