X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=ao-bringup%2Ftest-chaoskey;h=3d510971ffc84307d3a6a3a32b89e37df03c3d40;hb=c31db066e5ba7a6708ebe4bf350963697c611816;hp=db5aed6e82346543895260f18098c440fdc40320;hpb=c4926a69d6e72a035197b3d617c62893a7ea1861;p=fw%2Faltos diff --git a/ao-bringup/test-chaoskey b/ao-bringup/test-chaoskey index db5aed6e..3d510971 100755 --- a/ao-bringup/test-chaoskey +++ b/ao-bringup/test-chaoskey @@ -12,7 +12,17 @@ case "$#" in serial="--serial $1" ;; 0) - serial="" + snum=`sudo dmesg -t | awk '/usb.*Product:/ { ck = index($0, "ChaosKey"); } + /usb.*SerialNumber:/ { if (ck) print $4; }' | tail -1` + + case "$snum" in + "") + serial="" + ;; + *) + serial="--serial $snum" + ;; + esac ;; *) echo "Usage: $0 [serial]" @@ -20,12 +30,14 @@ case "$#" in ;; esac +echo -e '\e[34mTesting ChaosKey' $snum '\e[39m' + tests="0:100 1:100 2:100 3:100 12:10 13:100 15:10000 16:250 202:1000 203:100 204:500 206:20 207:1000:32 209:1000" PASS=0 FAIL=0 WEAK=0 -../ao-tools/ao-chaosread/ao-chaosread $serial --infinite --bytes | for test in $tests done; do +chaosread $serial --infinite --bytes | for test in $tests done; do case $test in *:*:*) dnum=`echo $test | sed 's/:.*$//'` @@ -72,11 +84,11 @@ done | while read result; do echo pass $PASS weak $WEAK fail $FAIL case $PASS:$FAIL in [1-9]*:0) - echo ChaosKey $snum is ready to ship + echo -e '\e[32m'ChaosKey $snum is ready to ship'\e[39m' exit 0 ;; *) - echo ChaosKey $snum failed + echo -e '\e[31m'ChaosKey $snum failed'\e[39m' exit 1 ;; esac