-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot_tbt_xml.sh
executable file
·200 lines (177 loc) · 6.62 KB
/
boot_tbt_xml.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#!/bin/bash
BIOS_USB_NODE=""
LINUX_VER=$(uname -r)
DATE=$(date +%m-%d_%H_%M)
LOG_PATH="/opt/logs/TBT_LOG"
TBT_LOG="/opt/logs/TBT_${LINUX_VER}_${DATE}"
BIOS_DATA="/data_tbt"
DATE_FILE="${BIOS_DATA}/date"
RUN_TBT_FILE="${LOG_PATH}/run_tbt_xml.log"
TBT_COMMONS="tbt_secure_tests tbt_bat_tests tbt_func_tests tbt_userspace_tests tbt_hotplug_tests tbt_rtd3_tests tbt_suspend_resume_tests tbt_preboot_tests tbt_vtd_tests"
PF_FILE="${BIOS_DATA}/platform"
ONLY_MODE="mode_set.txt"
ONLY_SET="only_set.txt"
PF=""
check_tbt_folder() {
[[ -d "$BIOS_DATA" ]] || {
echo "mkdir $BIOS_DATA"
mkdir $BIOS_DATA
}
[[ -e "$BIOS_DATA/set_none.ini" ]] || {
echo "No $BIOS_DATA/set_none.ini file, exit"
exit 2
}
[[ -e "$BIOS_DATA/set_user.ini" ]] || {
echo "No $BIOS_DATA/set_user.ini file, exit"
exit 2
}
[[ -e "$BIOS_DATA/set_secure.ini" ]] || {
echo "No $BIOS_DATA/set_secure.ini file, exit"
exit 2
}
[[ -e "$BIOS_DATA/set_dp.ini" ]] || {
echo "No $BIOS_DATA/set_dp.ini file, exit"
exit 2
}
}
find_pf() {
[[ -e "$PF_FILE" ]] || {
echo "file ${PF_FILE} could not find at $(date +%m-%d_%H_%M)" >> $RUN_TBT_FILE
exit 1
}
PF=$(cat ${PF_FILE})
[[ -n "$PF" ]] || {
echo "PF is null:$PF, exit at $(date +%m-%d_%H_%M)" >> $RUN_TBT_FILE
exit 1
}
}
test_tbt() {
tbt_done_file=""
ddt_path=$(ls -1 /home/* | grep ^/home | grep "ltp-ddt_" | tail -n 1 | cut -d ':' -f 1)
all_set_txt="${BIOS_DATA}/*set*.txt"
origin_date=$(cat $DATE_FILE)
tbt_common=""
tbt_log_file=""
present_date=$(date +%m-%d_%H_%M)
if [[ -z "$origin_date" ]]; then
TBT_LOG="/opt/logs/TBT_${LINUX_VER}_${DATE}"
else
TBT_LOG="/opt/logs/TBT_${LINUX_VER}_${origin_date}"
fi
[[ -d "$LOG_PATH" ]] || {
echo "No folder $LOG_PATH exist, create it"
mkdir -p $LOG_PATH
}
[[ -e "$BIOS_DATA/$ONLY_SET" ]] && {
echo "$DATE, $BIOS_DATA/$ONLY_SET exist, rm $BIOS_DATA/$all_set_txt" >> $RUN_TBT_FILE
rm -rf $BIOS_DATA/$all_set_txt
exit 0
}
[[ -z "$PF" ]] && PF="cfl-h-rvp"
cd $BIOS_DATA
tbt_done_file=$(ls -1 *set_done.txt 2>/dev/null)
echo >> $RUN_TBT_FILE
echo "**********************************" >> $RUN_TBT_FILE
echo "$DATE, ddt path:$ddt_path" >> $RUN_TBT_FILE
case ${tbt_done_file} in
none_set_done.txt)
cd $ddt_path
echo "none mode test" >> $RUN_TBT_FILE
echo "./runtests.sh -p $PF -P $PF -f ddt_intel/tbt_none_tests -o $TBT_LOG -c" >> $RUN_TBT_FILE
./runtests.sh -p $PF -P $PF -f ddt_intel/tbt_none_tests -o $TBT_LOG -c
#echo "./runtests.sh -p $PF -P $PF -f ddt_intel/tbt_func_tests -o $TBT_LOG -c" >> $RUN_TBT_FILE
#./runtests.sh -p $PF -P $PF -f ddt_intel/tbt_func_tests -o $TBT_LOG -c
dmesg > "${TBT_LOG}/dmesg_none_${present_date}.txt"
echo "record dmesg:${TBT_LOG}/dmesg_none_${present_date}.txt"
if [[ -e "${BIOS_DATA}/${ONLY_MODE}" ]]; then
echo "$(date +%m-%d_%H_%M): contain ${ONLY_MODE}, delete *set*.txt" >> $RUN_TBT_FILE
rm -rf $all_set_txt
exit 0
else
echo "$(date +%m-%d_%H_%M): delete *set*.txt, set user mode bios" >> $RUN_TBT_FILE
rm -rf $all_set_txt
echo "$(date +%m-%d_%H_%M): boot_tbt_xml: bios-tbt.py -i ${BIOS_DATA}/set_user.ini" >> $RUN_TBT_FILE
bios-tbt.py -i ${BIOS_DATA}/set_user.ini
echo "next" > ${BIOS_DATA}/user_set_done.txt
sleep 1
reboot
fi
echo "$(ls $BIOS_DATA)" >> $RUN_TBT_FILE
;;
user_set_done.txt)
cd $ddt_path
echo "user mode test" >> $RUN_TBT_FILE
echo "./runtests.sh -p $PF -P $PF -f ddt_intel/tbt_user_tests -o $TBT_LOG -c" >> $RUN_TBT_FILE
./runtests.sh -p $PF -P $PF -f ddt_intel/tbt_user_tests -o $TBT_LOG -c
dmesg > "${TBT_LOG}/dmesg_user_${present_date}.txt"
echo "record dmesg:${TBT_LOG}/dmesg_user_${present_date}.txt"
if [[ -e "${BIOS_DATA}/${ONLY_MODE}" ]]; then
echo "$(date +%m-%d_%H_%M): contain ${ONLY_MODE}, delete *set*.txt" >> $RUN_TBT_FILE
rm -rf $all_set_txt
exit 0
else
echo "$(date +%m-%d_%H_%M): delete *set*.txt, set secure mode bios" >> $RUN_TBT_FILE
rm -rf $all_set_txt
echo "$(date +%m-%d_%H_%M): boot_tbt_xml: bios-tbt.py -i ${BIOS_DATA}/set_secure.ini" >> $RUN_TBT_FILE
bios-tbt.py -i ${BIOS_DATA}/set_secure.ini
echo "next" > ${BIOS_DATA}/secure_set_done.txt
reboot
fi
;;
secure_set_done.txt)
cd $ddt_path
echo "secure mode test" >> $RUN_TBT_FILE
for tbt_common in ${TBT_COMMONS}; do
tbt_log_file="DDT_${tbt_common}.log"
if [[ -e "${TBT_LOG}/${tbt_log_file}" ]]; then
echo "Already ran ${TBT_LOG}/${tbt_log_file}, skip at $(date +%m-%d_%H_%M)" >> $RUN_TBT_FILE
continue
else
echo "./runtests.sh -p $PF -P $PF -f ddt_intel/${tbt_common} -o $TBT_LOG -c" >> $RUN_TBT_FILE
./runtests.sh -p $PF -P $PF -f ddt_intel/${tbt_common} -o $TBT_LOG -c
fi
done
dmesg > "${TBT_LOG}/dmesg_secure_${present_date}.txt"
echo "record dmesg:${TBT_LOG}/dmesg_secure_${present_date}.txt"
if [[ -e "${BIOS_DATA}/${ONLY_MODE}" ]]; then
echo "$(date +%m-%d_%H_%M): contain ${ONLY_MODE}, delete *set*.txt" >> $RUN_TBT_FILE
rm -rf $all_set_txt
exit 0
else
echo "$(date +%m-%d_%H_%M): delete *set*.txt, set dp mode bios" >> $RUN_TBT_FILE
rm -rf $all_set_txt
echo "$(date +%m-%d_%H_%M): boot_tbt_xml: bios-tbt.py -i ${BIOS_DATA}/set_dp.ini" >> $RUN_TBT_FILE
bios-tbt.py -i ${BIOS_DATA}/set_dp.ini
echo "next" > ${BIOS_DATA}/dp_set_done.txt
reboot
fi
;;
dp_set_done.txt)
cd $ddt_path
echo "dp mode test" >> $RUN_TBT_FILE
echo "./runtests.sh -p $PF -P $PF -f ddt_intel/tbt_dp_tests -o $TBT_LOG -c" >> $RUN_TBT_FILE
./runtests.sh -p $PF -P $PF -f ddt_intel/tbt_dp_tests -o $TBT_LOG -c
dmesg > "${TBT_LOG}/dmesg_dp_${present_date}.txt"
echo "record dmesg:${TBT_LOG}/dmesg_dp_${present_date}.txt"
if [[ -e "${BIOS_DATA}/${ONLY_MODE}" ]]; then
echo "$(date +%m-%d_%H_%M): contain ${ONLY_MODE}, delete *set*.txt" >> $RUN_TBT_FILE
rm -rf $all_set_txt
else
echo "$(date +%m-%d_%H_%M): delete *set*.txt, set all_set_done.txt in $BIOS_DATA" >> $RUN_TBT_FILE
rm -rf $all_set_txt
echo "done" > $BIOS_DATA/all_set_done.txt
fi
;;
all_set_done.txt)
echo "All tbt cases finished"
echo "$DATE: All tbt cases finished preset time $(date +%m-%d_%H_%M), systemd tbt exit" >> $RUN_TBT_FILE
exit 0
;;
*)
echo "$DATE: no useful *set_done.txt, systemd tbt exit, present time $(date +%m-%d_%H_%M)" >> $RUN_TBT_FILE
exit 0
esac
}
check_tbt_folder
find_pf
test_tbt