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 uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/25967 ) Change subject: add initial testing scripts for a hw-driven ci - flash every image and test ...................................................................... add initial testing scripts for a hw-driven ci - flash every image and test Change-Id: I88bc32334f23e6fd702e0cbcb1b1510029909b20 --- A tests/README A tests/run-tests A tests/simtrace2/01_check_rig.out A tests/simtrace2/01_check_rig.sh A tests/simtrace2/02_erase_board.out A tests/simtrace2/02_erase_board.sh A tests/simtrace2/03_flash_bl_bossac.out A tests/simtrace2/03_flash_bl_bossac.sh A tests/simtrace2/04_flash_dfu.out A tests/simtrace2/04_flash_dfu.sh A tests/simtrace2/05_check_lsusb.out A tests/simtrace2/05_check_lsusb.sh A tests/simtrace2/06_check_dfu_lsusb.out A tests/simtrace2/06_check_dfu_lsusb.sh A tests/simtrace2/07_flash_dfu_from_app.out A tests/simtrace2/07_flash_dfu_from_app.sh A tests/simtrace2/08_test_simtrace.out A tests/simtrace2/08_test_simtrace.sh A tests/simtrace2/README A tests/simtrace2/TODO A tests/simtrace2/ctl_erase_target.sh A tests/simtrace2/ctl_get_relay_sn.sh A tests/simtrace2/ctl_reset_target.sh A tests/simtrace2/ctl_reset_to_dfu.sh A tests/simtrace2/fetch_image.sh A tests/simtrace2/flash_simtrace_bossac.sh A tests/simtrace2/flash_simtrace_dfu.sh A tests/simtrace2/get_installed_version.sh A tests/simtrace2/notes_relay_board.txt A tests/simtrace2/notes_wiring.txt A tests/simtrace2/prepare A tests/simtrace2/regen A tests/simtrace2/run-tests A tests/simtrace2/test-data 34 files changed, 879 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/67/25967/1 diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..3c10c7f --- /dev/null +++ b/tests/README @@ -0,0 +1,9 @@ +simtrace2-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 and a simtrace board, a simcard and a pcsc compatible cardreader. a hub is recommended to only need one instead of 3 upstream ports. + +the simtrace is modified to allow for switchable vcc, remote buttons and jumpers - vcc, bootloader, reset, erase-jumper which are wired to 4 relays. + diff --git a/tests/run-tests b/tests/run-tests new file mode 100755 index 0000000..6bb5f63 --- /dev/null +++ b/tests/run-tests @@ -0,0 +1,14 @@ +#!/bin/sh -e +echo "==========================================================" +echo " EXECUTING TESTS FOR SIMTRACE-FIRMWARE" +echo "==========================================================" +echo "" +cd ./simtrace2 +echo "Location $PWD" +echo "" +sh ./run-tests +cd .. +echo "" +echo "" +echo "" +echo "" diff --git a/tests/simtrace2/01_check_rig.out b/tests/simtrace2/01_check_rig.out new file mode 100644 index 0000000..4a6e0f1 --- /dev/null +++ b/tests/simtrace2/01_check_rig.out @@ -0,0 +1,240 @@ +relay box + +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 + iProduct 2 + iSerial 3 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 67 + 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 Unused + 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 + +ccid reader + +ID 076b:6632 OmniKey AG +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 8 + idVendor 0x076b OmniKey AG + idProduct 0x6632 + bcdDevice 1.03 + iManufacturer 1 + iProduct 2 + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 93 + bNumInterfaces 1 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 3 + bInterfaceClass 11 Chip/SmartCard + bInterfaceSubClass 0 + bInterfaceProtocol 0 + iInterface 2 + ChipCard Interface Descriptor: + bLength 54 + bDescriptorType 33 + bcdCCID 1.10 (Warning: Only accurate for version 1.0) + nMaxSlotIndex 0 + bVoltageSupport 7 5.0V 3.0V 1.8V + dwProtocols 3 T=0 T=1 + dwDefaultClock 4800 + dwMaxiumumClock 8000 + bNumClockSupported 4 + dwDataRate 10752 bps + dwMaxDataRate 412903 bps + bNumDataRatesSupp. 96 + dwMaxIFSD 254 + dwSyncProtocols 00000007 2-wire 3-wire I2C + dwMechanical 00000000 + dwFeatures 000407B8 + Auto voltage selection + Auto clock change + Auto baud rate change + Auto PPS made by CCID + CCID can set ICC in clock stop mode + NAD value other than 0x00 accepted + Auto IFSD exchange + Short and extended APDU level exchange + dwMaxCCIDMsgLen 271 + bClassGetResponse echo + bClassEnvelope echo + wlcdLayout none + bPINSupport 3 verification modification + bMaxCCIDBusySlots 1 + 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 0x0008 1x 8 bytes + bInterval 24 + +usb hub + +ID 05e3:0608 Genesys Logic, Inc. Hub +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 9 Hub + bDeviceSubClass 0 Unused + bDeviceProtocol 1 Single TT + bMaxPacketSize0 64 + idVendor 0x05e3 Genesys Logic, Inc. + idProduct 0x0608 Hub + bcdDevice 7.02 + iManufacturer 0 + iProduct 1 + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 25 + bNumInterfaces 1 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xe0 + Self Powered + Remote Wakeup + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 1 + bInterfaceClass 9 Hub + bInterfaceSubClass 0 Unused + bInterfaceProtocol 0 Full speed (or root) hub + iInterface 0 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x81 EP 1 IN + bmAttributes 3 + Transfer Type Interrupt + Synch Type None + Usage Type Data + wMaxPacketSize 0x0001 1x 1 bytes + bInterval 12 diff --git a/tests/simtrace2/01_check_rig.sh b/tests/simtrace2/01_check_rig.sh new file mode 100755 index 0000000..7592a77 --- /dev/null +++ b/tests/simtrace2/01_check_rig.sh @@ -0,0 +1,12 @@ +#!/bin/sh -e +. ./test-data + +echo relay box +lsusb -d $USBD_RELAY -v 2>/dev/null | sed -e "s/$Bus.*Device.*:\ ID/ID/g" +echo +echo ccid reader +lsusb -d $USBD_CCID -v 2>/dev/null | sed -e "s/$Bus.*Device.*:\ ID/ID/g" +echo +echo usb hub +lsusb -d $USBD_HUB -v 2>/dev/null | sed -e "s/$Bus.*Device.*:\ ID/ID/g" + diff --git a/tests/simtrace2/02_erase_board.out b/tests/simtrace2/02_erase_board.out new file mode 100644 index 0000000..1d258ce --- /dev/null +++ b/tests/simtrace2/02_erase_board.out @@ -0,0 +1,2 @@ +erasing target +done diff --git a/tests/simtrace2/02_erase_board.sh b/tests/simtrace2/02_erase_board.sh new file mode 100755 index 0000000..9da0356 --- /dev/null +++ b/tests/simtrace2/02_erase_board.sh @@ -0,0 +1,4 @@ +#!/bin/sh -e +. ./test-data + +./ctl_erase_target.sh diff --git a/tests/simtrace2/03_flash_bl_bossac.out b/tests/simtrace2/03_flash_bl_bossac.out new file mode 100644 index 0000000..e446885 --- /dev/null +++ b/tests/simtrace2/03_flash_bl_bossac.out @@ -0,0 +1,11 @@ +Erase flash + +Done in 0.009 seconds +Write 13488 bytes to flash (53 pages) + [ ] 0% (0/53 pages) [= ] 3% (2/53 pages) [= ] 5% (3/53 pages) [== ] 7% (4/53 pages) [== ] 9% (5/53 pages) [=== ] 11% (6/53 pages) [=== ] 13% (7/53 pages) [==== ] 15% (8/53 pages) [===== ] 16% (9/53 pages) [===== ] 18% (10/53 pages) [====== ] 20% (11/53 pages) [====== ] 22% (12/53 pages) [======= ] 24% (13/53 pages) [======= ] 26% (14/53 pages) [======== ] 28% (15/53 pages) [========= ] 30% (16/53 pages) [========= ] 32% (17/53 pages) [========== ] 33% (18/53 pages) [========== ] 35% (19/53 pages) [=========== ] 37% (20/53 pages) [=========== ] 39% (21/53 pages) [============ ] 41% (22/53 pages) [============= ] 43% (23/53 pages) [============= ] 45% (24/53 pages) [============== ] 47% (25/53 pages) [============== ] 49% (26/53 pages) [=============== ] 50% (27/53 pages) [=============== ] 52% (28/53 pages) [================ ] 54% (29/53 pages) [================ ] 56% (30/53 pages) [================= ] 58% (31/53 pages) [================== ] 60% (32/53 pages) [================== ] 62% (33/53 pages) [=================== ] 64% (34/53 pages) [=================== ] 66% (35/53 pages) [==================== ] 67% (36/53 pages) [==================== ] 69% (37/53 pages) [===================== ] 71% (38/53 pages) [====================== ] 73% (39/53 pages) [====================== ] 75% (40/53 pages) [======================= ] 77% (41/53 pages) [======================= ] 79% (42/53 pages) [======================== ] 81% (43/53 pages) [======================== ] 83% (44/53 pages) [========================= ] 84% (45/53 pages) [========================== ] 86% (46/53 pages) [========================== ] 88% (47/53 pages) [=========================== ] 90% (48/53 pages) [=========================== ] 92% (49/53 pages) [============================ ] 94% (50/53 pages) [============================ ] 96% (51/53 pages) [============================= ] 98% (52/53 pages) [==============================] 100% (53/53 pages) +Done in 0.378 seconds +Verify 13488 bytes of flash + [= ] 3% (2/53 pages) [= ] 5% (3/53 pages) [== ] 7% (4/53 pages) [== ] 9% (5/53 pages) [=== ] 11% (6/53 pages) [=== ] 13% (7/53 pages) [==== ] 15% (8/53 pages) [===== ] 16% (9/53 pages) [===== ] 18% (10/53 pages) [====== ] 20% (11/53 pages) [====== ] 22% (12/53 pages) [======= ] 24% (13/53 pages) [======= ] 26% (14/53 pages) [======== ] 28% (15/53 pages) [========= ] 30% (16/53 pages) [========= ] 32% (17/53 pages) [========== ] 33% (18/53 pages) [========== ] 35% (19/53 pages) [=========== ] 37% (20/53 pages) [=========== ] 39% (21/53 pages) [============ ] 41% (22/53 pages) [============= ] 43% (23/53 pages) [============= ] 45% (24/53 pages) [============== ] 47% (25/53 pages) [============== ] 49% (26/53 pages) [=============== ] 50% (27/53 pages) [=============== ] 52% (28/53 pages) [================ ] 54% (29/53 pages) [================ ] 56% (30/53 pages) [================= ] 58% (31/53 pages) [================== ] 60% (32/53 pages) [================== ] 62% (33/53 pages) [=================== ] 64% (34/53 pages) [=================== ] 66% (35/53 pages) [==================== ] 67% (36/53 pages) [==================== ] 69% (37/53 pages) [===================== ] 71% (38/53 pages) [====================== ] 73% (39/53 pages) [====================== ] 75% (40/53 pages) [======================= ] 77% (41/53 pages) [======================= ] 79% (42/53 pages) [======================== ] 81% (43/53 pages) [======================== ] 83% (44/53 pages) [========================= ] 84% (45/53 pages) [========================== ] 86% (46/53 pages) [========================== ] 88% (47/53 pages) [=========================== ] 90% (48/53 pages) [=========================== ] 92% (49/53 pages) [============================ ] 94% (50/53 pages) [============================ ] 96% (51/53 pages) [============================= ] 98% (52/53 pages) [==============================] 100% (53/53 pages) +Verify successful +Done in 0.297 seconds +Set boot flash true diff --git a/tests/simtrace2/03_flash_bl_bossac.sh b/tests/simtrace2/03_flash_bl_bossac.sh new file mode 100755 index 0000000..1a53763 --- /dev/null +++ b/tests/simtrace2/03_flash_bl_bossac.sh @@ -0,0 +1,5 @@ +#!/bin/sh -e +. ./test-data + +./flash_simtrace_bossac.sh +sleep 1 diff --git a/tests/simtrace2/04_flash_dfu.out b/tests/simtrace2/04_flash_dfu.out new file mode 100644 index 0000000..2f7712d --- /dev/null +++ b/tests/simtrace2/04_flash_dfu.out @@ -0,0 +1,25 @@ +installed fw version: 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:60e3 +Run-time device DFU version 0100 +Claiming USB DFU Interface... +Setting Alternate Setting #1 ... +Determining device status: state = dfuIDLE, status = 0 +dfuIDLE, continuing +DFU mode device DFU version 0100 +Device returned transfer size 512 +Copying data from PC to DFU device +Download done. +state(7) = dfuMANIFEST, status(0) = No error condition is present +state(2) = dfuIDLE, status(0) = No error condition is present +Done! +Resetting USB to switch back to runtime mode +installed fw version: 0.7.0.158-020ed diff --git a/tests/simtrace2/04_flash_dfu.sh b/tests/simtrace2/04_flash_dfu.sh new file mode 100755 index 0000000..f9d6f3a --- /dev/null +++ b/tests/simtrace2/04_flash_dfu.sh @@ -0,0 +1,8 @@ +#!/bin/sh -e +. ./test-data + +./get_installed_version.sh +./ctl_reset_to_dfu.sh +./flash_simtrace_dfu.sh +sleep 1 +./get_installed_version.sh diff --git a/tests/simtrace2/05_check_lsusb.out b/tests/simtrace2/05_check_lsusb.out new file mode 100644 index 0000000..a59be4b --- /dev/null +++ b/tests/simtrace2/05_check_lsusb.out @@ -0,0 +1,110 @@ + +ID 1d50:60e3 OpenMoko, Inc. Osmocom SIMtrace 2 +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x1d50 OpenMoko, Inc. + idProduct 0x60e3 Osmocom SIMtrace 2 + bcdDevice 0.02 + iManufacturer 1 sysmocom - s.f.m.c. GmbH + iProduct 2 SIMtrace 2 + iSerial 11 51203220574a4a523030362030323037 + bNumConfigurations 2 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 57 + bNumInterfaces 2 + bConfigurationValue 1 + iConfiguration 3 SIMtrace Sniffer + bmAttributes 0x80 + (Bus Powered) + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 3 + bInterfaceClass 255 Vendor Specific Class + bInterfaceSubClass 1 + bInterfaceProtocol 0 + iInterface 3 SIMtrace Sniffer + 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 0x82 EP 2 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 0x83 EP 3 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 1 + bAlternateSetting 0 + bNumEndpoints 0 + bInterfaceClass 254 Application Specific Interface + bInterfaceSubClass 1 Device Firmware Update + bInterfaceProtocol 1 + iInterface 0 + Device Firmware Upgrade Interface Descriptor: + bLength 9 + bDescriptorType 33 + bmAttributes 11 + Will Detach + Manifestation Intolerant + Upload Supported + Download Supported + wDetachTimeout 0 milliseconds + wTransferSize 512 bytes + bcdDFUVersion 1.00 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 18 + bNumInterfaces 1 + bConfigurationValue 2 + iConfiguration 12 firmware version + bmAttributes 0x80 + (Bus Powered) + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 0 + bInterfaceClass 255 Vendor Specific Class + bInterfaceSubClass 255 Vendor Specific Subclass + bInterfaceProtocol 0 + iInterface 13 0.7.0.158-020ed +Device Status: 0x0000 + (Bus Powered) diff --git a/tests/simtrace2/05_check_lsusb.sh b/tests/simtrace2/05_check_lsusb.sh new file mode 100755 index 0000000..3facf79 --- /dev/null +++ b/tests/simtrace2/05_check_lsusb.sh @@ -0,0 +1,5 @@ +#!/bin/sh -e +. ./test-data + +lsusb -d $USBD_TARGET -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/simtrace2/06_check_dfu_lsusb.out b/tests/simtrace2/06_check_dfu_lsusb.out new file mode 100644 index 0000000..755cad7 --- /dev/null +++ b/tests/simtrace2/06_check_dfu_lsusb.out @@ -0,0 +1,94 @@ +resetting target to dfu +done + +ID 1d50:60e3 OpenMoko, Inc. Osmocom SIMtrace 2 +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x1d50 OpenMoko, Inc. + idProduct 0x60e3 Osmocom SIMtrace 2 + bcdDevice 0.00 + iManufacturer 1 sysmocom - s.f.m.c. GmbH + iProduct 2 SIMtrace 2 + iSerial 7 51203220574a4a523030362030323037 + bNumConfigurations 2 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 45 + bNumInterfaces 1 + bConfigurationValue 1 + iConfiguration 3 DFU (Device Firmware Upgrade) + bmAttributes 0x80 + (Bus Powered) + MaxPower 200mA + 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 4 RAM + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 1 + bNumEndpoints 0 + bInterfaceClass 254 Application Specific Interface + bInterfaceSubClass 1 Device Firmware Update + bInterfaceProtocol 2 + iInterface 5 Flash (Application Partition) + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 2 + bNumEndpoints 0 + bInterfaceClass 254 Application Specific Interface + bInterfaceSubClass 1 Device Firmware Update + bInterfaceProtocol 2 + iInterface 6 not available + Device Firmware Upgrade Interface Descriptor: + bLength 9 + bDescriptorType 33 + bmAttributes 11 + Will Detach + Manifestation Intolerant + Upload Supported + Download Supported + wDetachTimeout 0 milliseconds + wTransferSize 512 bytes + bcdDFUVersion 1.00 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 18 + bNumInterfaces 1 + bConfigurationValue 2 + iConfiguration 8 firmware version + bmAttributes 0x80 + (Bus Powered) + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 0 + bInterfaceClass 255 Vendor Specific Class + bInterfaceSubClass 255 Vendor Specific Subclass + bInterfaceProtocol 0 + iInterface 9 0.7.0.158-020ed +Device Status: 0x0000 + (Bus Powered) +resetting target +done diff --git a/tests/simtrace2/06_check_dfu_lsusb.sh b/tests/simtrace2/06_check_dfu_lsusb.sh new file mode 100755 index 0000000..fda72c4 --- /dev/null +++ b/tests/simtrace2/06_check_dfu_lsusb.sh @@ -0,0 +1,6 @@ +#!/bin/sh -e +. ./test-data + +./ctl_reset_to_dfu.sh +lsusb -d $USBD_TARGET -v 2>/dev/null | sed -e "s/$Bus.*Device.*:\ ID/ID/g" +./ctl_reset_target.sh diff --git a/tests/simtrace2/07_flash_dfu_from_app.out b/tests/simtrace2/07_flash_dfu_from_app.out new file mode 100644 index 0000000..82a156f --- /dev/null +++ b/tests/simtrace2/07_flash_dfu_from_app.out @@ -0,0 +1,31 @@ +installed fw version: 0.7.0.158-020ed +resetting target +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:60e3 +Run-time device DFU version 0100 +Claiming USB DFU Runtime Interface... +Determining device status: state = appIDLE, status = 0 +Device really in Runtime Mode, send DFU detach request... +Device will detach and reattach... +Opening DFU USB Device... +Claiming USB DFU Interface... +Setting Alternate Setting #1 ... +Determining device status: state = dfuIDLE, status = 0 +dfuIDLE, continuing +DFU mode device DFU version 0100 +Device returned transfer size 512 +Copying data from PC to DFU device +Download done. +state(7) = dfuMANIFEST, status(0) = No error condition is present +state(2) = dfuIDLE, status(0) = No error condition is present +Done! +Resetting USB to switch back to runtime mode +installed fw version: 0.7.0.158-020ed diff --git a/tests/simtrace2/07_flash_dfu_from_app.sh b/tests/simtrace2/07_flash_dfu_from_app.sh new file mode 100755 index 0000000..3f9d770 --- /dev/null +++ b/tests/simtrace2/07_flash_dfu_from_app.sh @@ -0,0 +1,8 @@ +#!/bin/sh -e +. ./test-data + +./get_installed_version.sh +./ctl_reset_target.sh +./flash_simtrace_dfu.sh +sleep 1 +./get_installed_version.sh diff --git a/tests/simtrace2/08_test_simtrace.out b/tests/simtrace2/08_test_simtrace.out new file mode 100644 index 0000000..5ef2c84 --- /dev/null +++ b/tests/simtrace2/08_test_simtrace.out @@ -0,0 +1,35 @@ +resetting target +done +installed fw version: 0.7.0.158-020ed + +simtrace2-list +USB matches: 2 + 1d50:60e3 Addr=125, Path=2-1.2.3, Cfg=1, Intf=0, Alt=0: 255/1/0 (SIMtrace Sniffer) + 1d50:60e3 Addr=125, Path=2-1.2.3, Cfg=2, Intf=0, Alt=0: 255/255/0 (0.7.0.158-020ed) + +start simtrace2-sniff + +start pcsc_scan -n +stop pcsc_scan +PCSC PC/SC device scanner +PCSC V 1.4.27 (c) 2001-2011, Ludovic Rousseau <ludovic.rousseau at free.fr> +PCSC Compiled with PC/SC lite version: 1.8.17 +PCSC Using reader plug'n play mechanism +PCSC Scanning present readers... +PCSC 0: HID Global OMNIKEY 6121 Smart Card Reader [OMNIKEY 6121 Smart Card Reader] 00 00 +PCSC +PCSC Tue Oct 26 20:30:03 2021 +PCSC Reader 0: HID Global OMNIKEY 6121 Smart Card Reader [OMNIKEY 6121 Smart Card Reader] 00 00 +PCSC Card state: Card inserted, +PCSC ATR: 3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5 +PCSC SCardGetStatusChange: RPC transport error. +stop simtrace2-sniff +ST2 simtrace2-sniff - Phone-SIM card communication sniffer +ST2 (C) 2010-2017 by Harald Welte <laforge at gnumonks.org> +ST2 (C) 2018 by Kevin Redon <kredon at sysmocom.de> +ST2 +ST2 Using USB device 1d50:60e3 Addr=125, Path=2-1.2.3, Cfg=1, Intf=0, Alt=0: 255/1/0 (SIMtrace Sniffer) +ST2 Entering main loop +ST2 Card state change: reset de-asserted +ST2 ATR: 3b 9f 96 80 1f c7 80 31 a0 73 be 21 13 67 43 20 07 18 00 00 01 a5 +ST2 Card state change: reset asserted diff --git a/tests/simtrace2/08_test_simtrace.sh b/tests/simtrace2/08_test_simtrace.sh new file mode 100755 index 0000000..f430d7a --- /dev/null +++ b/tests/simtrace2/08_test_simtrace.sh @@ -0,0 +1,22 @@ +#!/bin/sh -e +. ./test-data +./ctl_reset_target.sh +sleep 1 +./get_installed_version.sh +echo +echo simtrace2-list +$SIMTRACE2_HOST_PATH/simtrace2-list +echo +echo start simtrace2-sniff +$SIMTRACE2_HOST_PATH/simtrace2-sniff 2>&1 |sed -e 's/^/ST2\ /;' & +sleep 1 +echo +echo start pcsc_scan -n +pcsc_scan -n 2>&1 |sed -e 's/^/PCSC\ /;' & +sleep 2 +echo stop pcsc_scan +killall -SIGINT pcsc_scan +sudo killall pcscd +echo stop simtrace2-sniff +killall -SIGINT simtrace2-sniff + diff --git a/tests/simtrace2/README b/tests/simtrace2/README new file mode 100644 index 0000000..6d442da --- /dev/null +++ b/tests/simtrace2/README @@ -0,0 +1,9 @@ +This testsuite assumes you have installed the following utilities: +- lsusb +- dfu-util +- wget +- bossac +- simtrace2-list +- simtrace2-sniff +- pcsc_scan/pcscd +- killall diff --git a/tests/simtrace2/TODO b/tests/simtrace2/TODO new file mode 100644 index 0000000..33e0891 --- /dev/null +++ b/tests/simtrace2/TODO @@ -0,0 +1,4 @@ + +maybe: +- send '8' to usbrelay box to get serial - how to read it back? expect? +- require serial for prepare to return 0 diff --git a/tests/simtrace2/ctl_erase_target.sh b/tests/simtrace2/ctl_erase_target.sh new file mode 100755 index 0000000..3b29d17 --- /dev/null +++ b/tests/simtrace2/ctl_erase_target.sh @@ -0,0 +1,27 @@ +#!/bin/sh -e +. ./test-data + +#usb_rly08 +# all off-on n-d +# relay1 = usbpower o-e +# relay2 = dfu-btn p-f +# relay3 = reset-btn q-g +# relay4 = erase jumper r-h + +echo "erasing target" +#all off +echo -n "n" > $USB_RELAY +sleep 1 +# 4 on +echo -n "h" > $USB_RELAY +sleep 1 +# 1 on +echo -n "e" > $USB_RELAY +sleep 1 +# all off +echo -n "n" > $USB_RELAY +sleep 1 +# 1 on +echo -n "e" > $USB_RELAY +sleep 1 +echo "done" diff --git a/tests/simtrace2/ctl_get_relay_sn.sh b/tests/simtrace2/ctl_get_relay_sn.sh new file mode 100755 index 0000000..ecfb39a --- /dev/null +++ b/tests/simtrace2/ctl_get_relay_sn.sh @@ -0,0 +1,12 @@ +#!/bin/sh +. ./test-data + +#usb_rly08 +# all off-on n-d +# relay1 = usbpower o-e +# relay2 = dfu-btn p-f +# relay3 = reset-btn q-g +# relay4 = erase jumper r-h + +echo "getting relay SN" +echo -n "8" > $USB_RELAY diff --git a/tests/simtrace2/ctl_reset_target.sh b/tests/simtrace2/ctl_reset_target.sh new file mode 100755 index 0000000..1d8427f --- /dev/null +++ b/tests/simtrace2/ctl_reset_target.sh @@ -0,0 +1,18 @@ +#!/bin/sh -e +. ./test-data + +#usb_rly08 +# all off-on n-d +# relay1 = usbpower o-e +# relay2 = dfu-btn p-f +# relay3 = reset-btn q-g +# relay4 = erase jumper r-h + +#all off +echo "resetting target" +echo -n "n" > $USB_RELAY +sleep 1 +# 1 on +echo -n "e" > $USB_RELAY +sleep 1 +echo "done" diff --git a/tests/simtrace2/ctl_reset_to_dfu.sh b/tests/simtrace2/ctl_reset_to_dfu.sh new file mode 100755 index 0000000..9c05340 --- /dev/null +++ b/tests/simtrace2/ctl_reset_to_dfu.sh @@ -0,0 +1,24 @@ +#!/bin/sh -e +. ./test-data + +#usb_rly08 +# all off-on n-d +# relay1 = usbpower o-e +# relay2 = dfu-btn p-f +# relay3 = reset-btn q-g +# relay4 = erase jumper r-h + +echo "resetting target to dfu" +#all off +echo -n "n" > $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/simtrace2/fetch_image.sh b/tests/simtrace2/fetch_image.sh new file mode 100755 index 0000000..5ce3591 --- /dev/null +++ b/tests/simtrace2/fetch_image.sh @@ -0,0 +1,7 @@ +#!/bin/sh -e +. ./test-data + +echo "fetch images" +wget -O $BL_IMAGE $BL_URL -nv +wget -O $APP_IMAGE $APP_URL -nv +echo "done" diff --git a/tests/simtrace2/flash_simtrace_bossac.sh b/tests/simtrace2/flash_simtrace_bossac.sh new file mode 100755 index 0000000..0065925 --- /dev/null +++ b/tests/simtrace2/flash_simtrace_bossac.sh @@ -0,0 +1,6 @@ +#!/bin/sh -e +. ./test-data + +sudo bossac --port $USB_TARGET --erase --write $BL_IMAGE --verify --boot=1 + +sleep 1 diff --git a/tests/simtrace2/flash_simtrace_dfu.sh b/tests/simtrace2/flash_simtrace_dfu.sh new file mode 100755 index 0000000..1bb175a --- /dev/null +++ b/tests/simtrace2/flash_simtrace_dfu.sh @@ -0,0 +1,5 @@ +#!/bin/sh -e +. ./test-data + +dfu-util --device $USBD_TARGET --cfg 1 --alt 1 --reset --download $APP_IMAGE 2>/dev/null |grep -v "Download\t"|grep -v "\[" +sleep 1 diff --git a/tests/simtrace2/get_installed_version.sh b/tests/simtrace2/get_installed_version.sh new file mode 100755 index 0000000..1b3f2b9 --- /dev/null +++ b/tests/simtrace2/get_installed_version.sh @@ -0,0 +1,6 @@ +#!/bin/sh -e +. ./test-data + +echo -n "installed fw version: " +lsusb -d $USBD_TARGET -v 2>/dev/null | grep iInterface -B 2|tr -d '\n' | sed 's/--/\n/g'|grep "bInterfaceSubClass 255"| rev | cut -d ' ' -f 1|rev + diff --git a/tests/simtrace2/notes_relay_board.txt b/tests/simtrace2/notes_relay_board.txt new file mode 100644 index 0000000..5669e92 --- /dev/null +++ b/tests/simtrace2/notes_relay_board.txt @@ -0,0 +1,28 @@ +usb_rly08 board http://www.robot-electronics.co.uk/htm/usb_rly08btech.htm + +Command + +Action +dec hex ascii + 56 38 8 Get serial number - returns 8 bytes of ASCII that form the unique serial number for module, I.E "00001543" + 90 5A Z Get software version - returns 2 bytes, the first being the Module ID which is 8, followed by the software version + 91 5B [ Get relay states - sends a single byte back to the controller, bit high meaning the corresponding relay is powered + 92 5C \ Set relay states - the next single byte will set all relays states, All on = 255 (11111111) All off = 0 +100 64 d All relays on +101 65 e Turn relay 1 on +102 66 f Turn relay 2 on +103 67 g Turn relay 3 on +104 68 h Turn relay 4 on +105 69 i Turn relay 5 on +106 6A j Turn relay 6 on +107 6B k Turn relay 7 on +108 6C l Turn relay 8 on +110 6E n All relays off +111 6F o Turn relay 1 off +112 70 p Turn relay 2 off +113 71 q Turn relay 3 off +114 72 r Turn relay 4 off +115 73 s Turn relay 5 off +116 74 t Turn relay 6 off +117 75 u Turn relay 7 off +118 76 v Turn relay 8 off diff --git a/tests/simtrace2/notes_wiring.txt b/tests/simtrace2/notes_wiring.txt new file mode 100644 index 0000000..6b8c1d9 --- /dev/null +++ b/tests/simtrace2/notes_wiring.txt @@ -0,0 +1,5 @@ + +relay1 - usb power target +relay2 - dfu-button (bootloader) target +relay3 - reset-button target - currently not used +relay4 - erase jumper target diff --git a/tests/simtrace2/prepare b/tests/simtrace2/prepare new file mode 100755 index 0000000..63ff09c --- /dev/null +++ b/tests/simtrace2/prepare @@ -0,0 +1,10 @@ +#!/bin/sh -e + +. ./test-data + +echo "================ PREPARING TEST RIG ================" +./ctl_reset_target.sh +echo "================ TEST RIG PREPARED =================" +echo "" + +./fetch_image.sh diff --git a/tests/simtrace2/regen b/tests/simtrace2/regen new file mode 100755 index 0000000..2978a0a --- /dev/null +++ b/tests/simtrace2/regen @@ -0,0 +1,19 @@ +#!/bin/sh -e +. ./test-data + +echo "Regenerating test output..." +./prepare +for T in $TESTS; do + echo "==> Executing Testcase $T" + EXPOUT=${T%%.sh}.out + ./$T > $EXPOUT + if [ $? -eq 0 ]; then + echo "Test $T passed" + else + echo "Test $T FAILED!" + fi +done + +echo "Reference output regenerated!" +echo "" + diff --git a/tests/simtrace2/run-tests b/tests/simtrace2/run-tests new file mode 100755 index 0000000..04b4591 --- /dev/null +++ b/tests/simtrace2/run-tests @@ -0,0 +1,46 @@ +#!/bin/sh + +# default: execute all tests + +. ./test-data + +# 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 +if [ $? -eq 0 ]; then + echo "Prepare done" +else + echo "Prepare Test FAILED!" + exit 2 +fi + +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/simtrace2/test-data b/tests/simtrace2/test-data new file mode 100644 index 0000000..05d6c95 --- /dev/null +++ b/tests/simtrace2/test-data @@ -0,0 +1,12 @@ +USBD_RELAY="04d8:ffee" +USB_RELAY="/dev/ttyACM0" +USBD_TARGET="1d50:60e3" +USB_TARGET="/dev/ttyACM1" +USBD_CCID="076b:6632" +USBD_HUB="05e3:0608" +BL_URL="https://downloads.osmocom.org/binaries/simtrace2/firmware/latest/simtrace-dfu-flash-latest.bin" +APP_URL="https://downloads.osmocom.org/binaries/simtrace2/firmware/latest/simtrace-trace-dfu-latest.bin" +BL_IMAGE="dl/simtrace-dfu-flash.bin" +APP_IMAGE="dl/simtrace-trace-dfu.bin" +SIMTRACE2_HOST_PATH="/home/roh/kunde/sysmocom/git.admin.sysmocom.de/simtrace2/host/src" +TESTS="01_check_rig.sh 02_erase_board.sh 03_flash_bl_bossac.sh 04_flash_dfu.sh 05_check_lsusb.sh 06_check_dfu_lsusb.sh 07_flash_dfu_from_app.sh 08_test_simtrace.sh" -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/25967 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I88bc32334f23e6fd702e0cbcb1b1510029909b20 Gerrit-Change-Number: 25967 Gerrit-PatchSet: 1 Gerrit-Owner: roh <jsteiger at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211026/8572b9ec/attachment.htm>