forked from tbird20d/grabserial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-output-filenames.sh
executable file
·96 lines (76 loc) · 2.53 KB
/
test-output-filenames.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/sh
#
# test-output-filenames.sh
#
if [ -n "$1" ] ; then
if [ "$1" = "-h" ] ; then
echo "Usage: test-output-filenames.sh [options]"
echo " -h Show this usage help"
echo ""
echo "Test different output filenames"
echo ""
exit 0
fi
fi
if [ -n "$1" ] ; then
echo "Unrecognized option '$1'"
echo "Use -h for help"
exit 0
fi
echo "Running grabserial on target 'bbb'"
# get the console device for target 'bbb'
console_dev="$(ttc info bbb -n console_dev)"
ls -ltr | grep -v total | grep -v dir_list >dir_list_before.txt
# Also, use ttc to reboot bbb
# use ttc to reboot my beaglebone black
echo "==================================="
echo "Testing with python 2"
echo " 60 second grab, stopping when 'Starting kernel' is seen"
echo " using filename '%'"
echo "==================================="
# do the reboot after grabserial is started
(sleep 1 ; ttc reboot bbb) &
# grab data from from that console device (-d ${console_dev},
# skipping the serial port sanity check (-S)
# end either in 60 seconds (-e 60) or when "Starting kernel" is seen
# (-q "Starting kernel")
# send data to graboutput.log (-o {filename}) (filename=%)
# show verbose messages (-v)
./grabserial -v -S -d ${console_dev} -e 60 -t -q "Starting kernel" \
-o %
echo "==== Done with grabserial capture ===="
echo
echo "==================================="
echo "Testing with python 2"
echo " 60 second grab, stopping when 'Starting kernel' is seen"
echo " using filename '%s.log'"
echo "==================================="
(sleep 1 ; ttc reboot bbb) &
./grabserial -v -S -d ${console_dev} -e 60 -t -q "Starting kernel" \
-o %s.log
echo "==== Done with grabserial capture ===="
echo
echo "==================================="
echo "Testing with python 2"
echo " 60 second grab, stopping when 'Starting kernel' is seen"
echo " using filename 'mylog-%F_%T.log'"
echo "==================================="
(sleep 1 ; ttc reboot bbb) &
./grabserial -v -S -d ${console_dev} -e 60 -t -q "Starting kernel" \
-o mylog-%F_%T.log
echo "==== Done with grabserial capture ===="
echo
echo "Checking for output filename"
echo
ls -ltr | grep -v total | grep -v dir_list >dir_list_after.txt
echo "New files:"
diff -u -B0 dir_list_before.txt dir_list_after.txt | \
grep -v dir_list | grep -v @@
rm dir_list_before.txt dir_list_after.txt
echo
echo "Should have 3 new files, with names like:"
echo "2020-12-02_22:10:06"
echo "1606971316.log"
echo "mylog-2020-12-02_22:10:25.log"
echo
echo "Done in test-output-filenames.sh"