This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
roh gerrit-no-reply at lists.osmocom.orgroh has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/17099 ) Change subject: Implement CI scripts for testing the resulting binary on hardware for jenkins ...................................................................... Implement CI scripts for testing the resulting binary on hardware for jenkins Change-Id: I3ddd2b9afda0e15883603566259c6e58571d2bc8 --- A tests/README A tests/run-tests A tests/sysmo-octsim/01_check_rig.out A tests/sysmo-octsim/01_check_rig.sh A tests/sysmo-octsim/02_flash_dfu.out A tests/sysmo-octsim/02_flash_dfu.sh A tests/sysmo-octsim/03_check_lsusb.out A tests/sysmo-octsim/03_check_lsusb.sh A tests/sysmo-octsim/04_check_dfu_lsusb.out A tests/sysmo-octsim/04_check_dfu_lsusb.sh A tests/sysmo-octsim/README A tests/sysmo-octsim/ctl_reset_target.sh A tests/sysmo-octsim/ctl_reset_to_dfu.sh A tests/sysmo-octsim/fetch_image.sh A tests/sysmo-octsim/flash_octsim_dfu.sh A tests/sysmo-octsim/get_installed_version.sh A tests/sysmo-octsim/prepare A tests/sysmo-octsim/regen A tests/sysmo-octsim/run-tests A tests/sysmo-octsim/test-data 20 files changed, 506 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve roh: Looks good to me, approved Hoernchen: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..552ac71 --- /dev/null +++ b/tests/README @@ -0,0 +1,7 @@ +osmo-ccid-firmware +================== + +this testbed is the hardware-CI interface to make sure the firmware built is also working when flashed onto hardware. + +to run it you will need a usb controlled relay board like the devantech_Ltd._USB-RLY08 and a sysmo-octsim board. + diff --git a/tests/run-tests b/tests/run-tests new file mode 100755 index 0000000..bfc942d --- /dev/null +++ b/tests/run-tests @@ -0,0 +1,14 @@ +#!/bin/sh +echo "==========================================================" +echo " EXECUTING TESTS FOR SYSMO-OCTSIM" +echo "==========================================================" +echo "" +cd ./sysmo-octsim +echo "Location $PWD" +echo "" +sh ./run-tests +cd .. +echo "" +echo "" +echo "" +echo "" diff --git a/tests/sysmo-octsim/01_check_rig.out b/tests/sysmo-octsim/01_check_rig.out new file mode 100644 index 0000000..1bd7d66 --- /dev/null +++ b/tests/sysmo-octsim/01_check_rig.out @@ -0,0 +1,90 @@ + +ID 04d8:ffee Microchip Technology, Inc. Devantech USB-ISS +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 2 Communications + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 8 + idVendor 0x04d8 Microchip Technology, Inc. + idProduct 0xffee Devantech USB-ISS + bcdDevice 1.00 + iManufacturer 1 Devantech Ltd. + iProduct 2 USB-RLY08 + iSerial 3 00021197 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 0x0043 + bNumInterfaces 2 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xc0 + Self Powered + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 1 + bInterfaceClass 2 Communications + bInterfaceSubClass 2 Abstract (modem) + bInterfaceProtocol 1 AT-commands (v.25ter) + iInterface 0 + CDC Header: + bcdCDC 1.10 + CDC ACM: + bmCapabilities 0x02 + line coding and serial state + CDC Union: + bMasterInterface 0 + bSlaveInterface 1 + CDC Call Management: + bmCapabilities 0x00 + bDataInterface 1 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x81 EP 1 IN + bmAttributes 3 + Transfer Type Interrupt + Synch Type None + Usage Type Data + wMaxPacketSize 0x0008 1x 8 bytes + bInterval 2 + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 1 + bAlternateSetting 0 + bNumEndpoints 2 + bInterfaceClass 10 CDC Data + bInterfaceSubClass 0 + bInterfaceProtocol 0 + iInterface 0 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x02 EP 2 OUT + bmAttributes 2 + Transfer Type Bulk + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 0 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x82 EP 2 IN + bmAttributes 2 + Transfer Type Bulk + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 0 +Device Status: 0x0001 + Self Powered diff --git a/tests/sysmo-octsim/01_check_rig.sh b/tests/sysmo-octsim/01_check_rig.sh new file mode 100755 index 0000000..3831fb6 --- /dev/null +++ b/tests/sysmo-octsim/01_check_rig.sh @@ -0,0 +1,4 @@ +#!/bin/sh +. ./test-data + +lsusb -d 04d8:ffee -v 2>/dev/null | sed -e "s/$Bus.*Device.*:\ ID/ID/g" diff --git a/tests/sysmo-octsim/02_flash_dfu.out b/tests/sysmo-octsim/02_flash_dfu.out new file mode 100644 index 0000000..eacc4d1 --- /dev/null +++ b/tests/sysmo-octsim/02_flash_dfu.out @@ -0,0 +1,23 @@ +fetch image +done +resetting target to dfu +done +dfu-util 0.9 + +Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. +Copyright 2010-2016 Tormod Volden and Stefan Schmidt +This program is Free Software and has ABSOLUTELY NO WARRANTY +Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ + +Opening DFU capable USB device... +ID 1d50:6141 +Run-time device DFU version 0110 +Claiming USB DFU Interface... +Setting Alternate Setting #0 ... +Determining device status: state = dfuIDLE, status = 0 +dfuIDLE, continuing +DFU mode device DFU version 0110 +Device returned transfer size 512 +Copying data from PC to DFU device +Download done. +Resetting USB to switch back to runtime mode diff --git a/tests/sysmo-octsim/02_flash_dfu.sh b/tests/sysmo-octsim/02_flash_dfu.sh new file mode 100755 index 0000000..c51d5b1 --- /dev/null +++ b/tests/sysmo-octsim/02_flash_dfu.sh @@ -0,0 +1,9 @@ +#!/bin/sh +. ./test-data + +./get_installed_version.sh +./fetch_image.sh +./ctl_reset_to_dfu.sh +./flash_octsim_dfu.sh +sleep 1 +./get_installed_version.sh diff --git a/tests/sysmo-octsim/03_check_lsusb.out b/tests/sysmo-octsim/03_check_lsusb.out new file mode 100644 index 0000000..bdc7672 --- /dev/null +++ b/tests/sysmo-octsim/03_check_lsusb.out @@ -0,0 +1,179 @@ + +ID 1d50:6141 OpenMoko, Inc. +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 2 Communications + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x1d50 OpenMoko, Inc. + idProduct 0x6141 + bcdDevice 0.00 + iManufacturer 1 sysmocom - s.f.m.c. GmbH + iProduct 2 sysmoOCTSIM + iSerial 7 ecc68ade3335355320202034463715ff + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 0x00a9 + bNumInterfaces 4 + bConfigurationValue 1 + iConfiguration 3 A + bmAttributes 0x80 + (Bus Powered) + MaxPower 500mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 1 + bAlternateSetting 0 + bNumEndpoints 1 + bInterfaceClass 2 Communications + bInterfaceSubClass 2 Abstract (modem) + bInterfaceProtocol 0 + iInterface 4 debug UART + CDC Header: + bcdCDC 10.01 + CDC Call Management: + bmCapabilities 0x01 + call management + bDataInterface 0 + CDC ACM: + bmCapabilities 0x02 + line coding and serial state + CDC Union: + bMasterInterface 1 + bSlaveInterface 2 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x82 EP 2 IN + bmAttributes 3 + Transfer Type Interrupt + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 10 + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 2 + bAlternateSetting 0 + bNumEndpoints 2 + bInterfaceClass 10 CDC Data + bInterfaceSubClass 0 + bInterfaceProtocol 0 + iInterface 5 debug UART + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x01 EP 1 OUT + bmAttributes 2 + Transfer Type Bulk + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 0 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x81 EP 1 IN + bmAttributes 2 + Transfer Type Bulk + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 0 + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 3 + bInterfaceClass 11 Chip/SmartCard + bInterfaceSubClass 0 + bInterfaceProtocol 0 + iInterface 6 CCID + ChipCard Interface Descriptor: + bLength 54 + bDescriptorType 33 + bcdCCID 1.10 (Warning: Only accurate for version 1.0) + nMaxSlotIndex 7 + bVoltageSupport 7 5.0V 3.0V 1.8V + dwProtocols 1 T=0 + dwDefaultClock 2500 + dwMaxiumumClock 20000 + bNumClockSupported 4 + dwDataRate 6720 bps + dwMaxDataRate 921600 bps + bNumDataRatesSupp. 0 + dwMaxIFSD 0 + dwSyncProtocols 00000000 + dwMechanical 00000000 + dwFeatures 000100B0 + Auto clock change + Auto baud rate change + Auto PPS made by CCID + TPDU level exchange + dwMaxCCIDMsgLen 272 + bClassGetResponse echo + bClassEnvelope echo + wlcdLayout none + bPINSupport 0 + bMaxCCIDBusySlots 8 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x02 EP 2 OUT + bmAttributes 2 + Transfer Type Bulk + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 0 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x83 EP 3 IN + bmAttributes 2 + Transfer Type Bulk + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 0 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x84 EP 4 IN + bmAttributes 3 + Transfer Type Interrupt + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 16 + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 3 + bAlternateSetting 0 + bNumEndpoints 0 + bInterfaceClass 254 Application Specific Interface + bInterfaceSubClass 1 Device Firmware Update + bInterfaceProtocol 1 + iInterface 8 sysmoOCTSIM DFU (Runtime) + Device Firmware Upgrade Interface Descriptor: + bLength 9 + bDescriptorType 33 + bmAttributes 8 + Will Detach + Manifestation Intolerant + Upload Unsupported + Download Unsupported + wDetachTimeout 0 milliseconds + wTransferSize 512 bytes + bcdDFUVersion 1.00 +Device Status: 0x0000 + (Bus Powered) diff --git a/tests/sysmo-octsim/03_check_lsusb.sh b/tests/sysmo-octsim/03_check_lsusb.sh new file mode 100755 index 0000000..f12e7d4 --- /dev/null +++ b/tests/sysmo-octsim/03_check_lsusb.sh @@ -0,0 +1,4 @@ +#!/bin/sh +. ./test-data + +lsusb -d 1d50:6141 -v 2>/dev/null | sed -e "s/$Bus.*Device.*:\ ID/ID/g"|sed -e "s/^.*iProduct.*2.*sysmoOCTSIM.*$/ iProduct 2 sysmoOCTSIM/g" diff --git a/tests/sysmo-octsim/04_check_dfu_lsusb.out b/tests/sysmo-octsim/04_check_dfu_lsusb.out new file mode 100644 index 0000000..4e8e136 --- /dev/null +++ b/tests/sysmo-octsim/04_check_dfu_lsusb.out @@ -0,0 +1,54 @@ +resetting target to dfu +done + +ID 1d50:6141 OpenMoko, Inc. +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x1d50 OpenMoko, Inc. + idProduct 0x6141 + bcdDevice 0.00 + iManufacturer 1 sysmocom + iProduct 2 sysmoOCTSIM (osmo-ASF4-DFU) + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 0x001b + bNumInterfaces 1 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0x80 + (Bus Powered) + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 0 + bInterfaceClass 254 Application Specific Interface + bInterfaceSubClass 1 Device Firmware Update + bInterfaceProtocol 2 + iInterface 3 SAM D5x/E5x DFU bootloader (DFU mode) + Device Firmware Upgrade Interface Descriptor: + bLength 9 + bDescriptorType 33 + bmAttributes 9 + Will Detach + Manifestation Intolerant + Upload Unsupported + Download Supported + wDetachTimeout 0 milliseconds + wTransferSize 512 bytes + bcdDFUVersion 1.10 +Device Status: 0x0000 + (Bus Powered) +resetting target +done diff --git a/tests/sysmo-octsim/04_check_dfu_lsusb.sh b/tests/sysmo-octsim/04_check_dfu_lsusb.sh new file mode 100755 index 0000000..eef2246 --- /dev/null +++ b/tests/sysmo-octsim/04_check_dfu_lsusb.sh @@ -0,0 +1,6 @@ +#!/bin/sh +. ./test-data + +./ctl_reset_to_dfu.sh +lsusb -d 1d50:6141 -v 2>/dev/null | sed -e "s/$Bus.*Device.*:\ ID/ID/g" +./ctl_reset_target.sh diff --git a/tests/sysmo-octsim/README b/tests/sysmo-octsim/README new file mode 100644 index 0000000..b3ac561 --- /dev/null +++ b/tests/sysmo-octsim/README @@ -0,0 +1,4 @@ +This testsuite assumes you have installed the following utilities: +- lsusb +- dfu-util +- wget diff --git a/tests/sysmo-octsim/ctl_reset_target.sh b/tests/sysmo-octsim/ctl_reset_target.sh new file mode 100755 index 0000000..6eed990 --- /dev/null +++ b/tests/sysmo-octsim/ctl_reset_target.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +#usb_rly08 serial +USB_RELAY="/dev/serial/by-id/usb-Devantech_Ltd._USB-RLY08_00021197-if00" + +#usb_rly08 +# relay1 = usbpower +# relay2 = dfu-btn + +#12 off +echo "resetting target" +echo -n "op" > $USB_RELAY +sleep 1 +# 1 on +echo -n "e" > $USB_RELAY +sleep 1 +echo "done" diff --git a/tests/sysmo-octsim/ctl_reset_to_dfu.sh b/tests/sysmo-octsim/ctl_reset_to_dfu.sh new file mode 100755 index 0000000..969ca0c --- /dev/null +++ b/tests/sysmo-octsim/ctl_reset_to_dfu.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +#usb_rly08 serial +USB_RELAY="/dev/serial/by-id/usb-Devantech_Ltd._USB-RLY08_00021197-if00" + +#usb_rly08 +# relay1 = usbpower +# relay2 = dfu-btn + +echo "resetting target to dfu" +#12 off +echo -n "op" > $USB_RELAY +sleep 1 +# 2 on +echo -n "f" > $USB_RELAY +sleep 1 +# 1 on +echo -n "e" > $USB_RELAY +sleep 1 +# 2 off +echo -n "p" > $USB_RELAY +sleep 1 +echo "done" diff --git a/tests/sysmo-octsim/fetch_image.sh b/tests/sysmo-octsim/fetch_image.sh new file mode 100755 index 0000000..c0a4f8f --- /dev/null +++ b/tests/sysmo-octsim/fetch_image.sh @@ -0,0 +1,6 @@ +#!/bin/sh +. ./test-data + +echo "fetch image" +wget -O dl/sysmoOCTSIM-latest.bin http://ftp.osmocom.org/binaries/osmo-ccid-firmware/latest/sysmoOCTSIM.bin -nv +echo "done" diff --git a/tests/sysmo-octsim/flash_octsim_dfu.sh b/tests/sysmo-octsim/flash_octsim_dfu.sh new file mode 100755 index 0000000..5b9c19a --- /dev/null +++ b/tests/sysmo-octsim/flash_octsim_dfu.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +dfu-util --device 1d50:6141 --alt 0 --reset --download dl/sysmoOCTSIM-latest.bin 2>/dev/null |grep -v "Download\t"|grep -v "\[" diff --git a/tests/sysmo-octsim/get_installed_version.sh b/tests/sysmo-octsim/get_installed_version.sh new file mode 100755 index 0000000..be61865 --- /dev/null +++ b/tests/sysmo-octsim/get_installed_version.sh @@ -0,0 +1,5 @@ +#!/bin/sh +. ./test-data + +echo -n "fw version: " 1>&2 +lsusb -d 1d50:6141 -v 2>/dev/null | grep iProduct|awk '{}{print $4}' 1>&2 diff --git a/tests/sysmo-octsim/prepare b/tests/sysmo-octsim/prepare new file mode 100755 index 0000000..bb95e40 --- /dev/null +++ b/tests/sysmo-octsim/prepare @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./test-data + +echo "================ PREPARING TEST RIG ================" +./ctl_reset_target.sh +echo "================ TEST RIG PREPARED =================" +echo "" diff --git a/tests/sysmo-octsim/regen b/tests/sysmo-octsim/regen new file mode 100755 index 0000000..7ed1fab --- /dev/null +++ b/tests/sysmo-octsim/regen @@ -0,0 +1,11 @@ +#!/bin/sh + +echo "Regenerating test output..." +./prepare +./01_check_rig.sh > ./01_check_rig.out +./02_flash_dfu.sh > ./02_flash_dfu.out +./03_check_lsusb.sh > ./03_check_lsusb.out +./04_check_dfu_lsusb.sh > ./04_check_dfu_lsusb.out +echo "Reference output regenerated!" +echo "" + diff --git a/tests/sysmo-octsim/run-tests b/tests/sysmo-octsim/run-tests new file mode 100755 index 0000000..b67c425 --- /dev/null +++ b/tests/sysmo-octsim/run-tests @@ -0,0 +1,39 @@ +#!/bin/sh + +# default: execute all tests +TESTS="01_check_rig.sh 02_flash_dfu.sh 03_check_lsusb.sh 04_check_dfu_lsusb.sh" + +# if command line specifies some specific tests, execute only those +if [ $# -ge 1 ]; then + TESTS=$* +fi + +TMP=`tempfile` +NUM_FAIL=0 + +# prepare test card +./prepare + +for T in $TESTS; do + echo "==> Executing Testcase $T" + EXPOUT=${T%%.sh}.out + rm $TMP + ./$T > $TMP + diff -u $EXPOUT $TMP + if [ $? -eq 0 ]; then + echo "Test $T passed" + else + echo "Test $T FAILED!" + NUM_FAIL=$((NUM_FAIL+1)) + fi +done + +echo +echo +echo "Summary: $NUM_FAIL Tests failed" + +if [ $NUM_FAIL -gt 0 ]; then + exit 1 +else + exit 0 +fi diff --git a/tests/sysmo-octsim/test-data b/tests/sysmo-octsim/test-data new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/sysmo-octsim/test-data -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/17099 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: I3ddd2b9afda0e15883603566259c6e58571d2bc8 Gerrit-Change-Number: 17099 Gerrit-PatchSet: 5 Gerrit-Owner: roh <jsteiger at sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: roh <jsteiger at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200225/2e8418aa/attachment.htm>