forked from lf-edge/eve
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify
More file actions
executable file
·102 lines (86 loc) · 3.84 KB
/
Copy pathverify
File metadata and controls
executable file
·102 lines (86 loc) · 3.84 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
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
#!/bin/sh
# shellcheck shell=dash
[ -n "$DEBUG" ] && set -x
#extract basic info
/usr/bin/hw-probe -all --show --verbose --check-extended --save "$REPORT" > "$REPORT/summary.log"
#storage device benchmarking
mkdir "$REPORT/storage-performance/"
for i in $(lsblk -anlb -o "TYPE,NAME,SIZE" | grep "^disk" | awk '$3 { print $2;}' | grep -v "^ram.*"); do
echo "Verifying disk /dev/$i"
#if dd if="/dev/$i" of=/dev/null bs=512 count=34 >/dev/null 2>&1; then
# echo "Read from device $i succeeded" >> "$REPORT/storage-check.log"
#else
# echo "Read from device $i failed" >> "$REPORT/storage-check.log"
#fi
/usr/bin/fio --filename="/dev/$i" --direct=1 --rw=randread --bs=4k --ioengine=libaio --runtime=10 --numjobs=4 --time_based --name=test --filesize=10M > "$REPORT/storage-performance/$i.log"
cat "$REPORT/storage-performance/$i.log"
done
#networking benchmarking
dhcpcd
nics=$(ifconfig -a | grep eth | awk '{print $1}')
mkdir "$REPORT/networking-checks/"
for nic in $nics
do
ifconfig "$nic" up
#check dhcp
if curl "www.google.com" > /dev/null 2>&1; then
echo "Network connectivity successful" > "$REPORT/networking-checks/dhcp-$nic.log";
echo "$nic with dhcp is working properly" >> "$REPORT/summary.log";
else
echo "Network connectivity failed" > "$REPORT/networking-checks/dhcp-$nic.log";
echo "$nic with dhcp is NOT working properly" >> "$REPORT/summary.log";
fi
network=$(ip a show "$nic" | awk '/inet / {print $2}' | cut -d"." -f1-3)
if [ -z "$network" ]; then
echo "No IP address found for $nic, skipping static configuration test" >> "$REPORT/summary.log";
continue
fi
# Loop through all possible IP addresses in the network range
for ip in $(seq 1 255)
do
# Check if the IP address is available
if ! ping -c1 -W1 "$network.$ip" > /dev/null 2>&1; then
ip route add default via "$network.$ip" dev "$nic"
break
fi
done
#check static
if curl "www.google.com" > /dev/null 2>&1; then
echo "Network connectivity successful" > "$REPORT/networking-checks/static-$nic.log";
echo "$nic with static configuration is working properly" >> "$REPORT/summary.log";
else
echo "Network connectivity failed" > "$REPORT/networking-checks/static-$nic.log";
echo "$nic with static configuration is NOT working" >> "$REPORT/summary.log";
fi
done
# There used to be a VM test here, using qemu, and ubuntu-22.04-minimal-cloud.img. It was commented out for a long time as of this writing.
# The installer image does not have qemu (~40MB) or the listed ubuntu-22.04 file (~287MB) installed.
# If they are needed, add qemu to the Dockerfile, as well as downloading the .img, but think long
# and hard if the size is needed. Look for alternatives. You can find the actual script code for the test from older commits.
tpm2_pcrread >> "$REPORT/summary.log"
cp "/root/etc/eve-release" "$REPORT"
find /sys/kernel/iommu_groups/ -type l > "$REPORT/iommu_groups.out"
watchdogs=$(find /dev -name "watchdog*" | grep -vw "/dev/watchdog")
watchdogs_count=$(echo "$watchdogs" | wc -l)
if [ "${watchdogs_count}" -gt "1" ]; then
echo "Warning: ${watchdogs_count} watchdogs available" > "$REPORT/watchdogs.log"
elif [ "${watchdogs_count}" -eq "1" ]; then
wdctl "${watchdogs}" >> "$REPORT/watchdogs.log"
else
echo "No watchdogs available" > "$REPORT/watchdogs.log"
fi
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
/vmcap > "$REPORT/vmcap.log"
fi
# verify the TPM
if [ -c "$TPM_DEVICE_PATH" ]; then
echo "TPM device is present, running some extra tests"
/verifytpm.sh | tee -a "$REPORT/tpmchecks.log" >/dev/console 2>&1
if ! grep -q "TPM checks PASSED" "$REPORT/tpmchecks.log"; then
echo "TPM checks FAILED, check tpmchecks.log for details" >> "$REPORT/summary.log";
fi
else
echo "No TPM device, skipping extra TPM checks"
fi
cat "$REPORT/summary.log"