1*** Variables *** 2${CPU} sysbus.cpu 3${UART} sysbus.uartB 4${URI} @https://dl.antmicro.com/projects/renode 5${SCRIPT} ${CURDIR}/../../scripts/single-node/quark_c1000.resc 6 7*** Test Cases *** 8Should Run Hello World 9 [Documentation] Runs Zephyr's 'hello_world' sample on Quark C1000 platform. 10 [Tags] zephyr uart 11 Execute Command $bin = ${URI}/hello_world.elf-s_314404-767e7a65942935de2abf276086957170847d99b5 12 Execute Script ${SCRIPT} 13 14 Create Terminal Tester ${UART} 15 Start Emulation 16 Wait For Line On Uart Hello World! x86 17 18Should Run Hello World With Sleep 19 [Documentation] Runs modified Zephyr's 'hello_world' sample on Quark C1000 platform. This one outputs 'Hello World! x86' on uart every 2 seconds. 20 [Tags] zephyr uart interrupts 21 Set Test Variable ${SLEEP_TIME} 2000 22 Set Test Variable ${SLEEP_TOLERANCE} 20 23 Set Test Variable ${REPEATS} 5 24 25 Execute Command $bin = ${URI}/hello_world-with-sleep.elf-s_317148-a279de34d55b10c97720845fdf7e58bd42bb0477 26 Execute Script ${SCRIPT} 27 28 Create Terminal Tester ${UART} 29 Start Emulation 30 31 ${l}= Create List 32 ${MAX_SLEEP_TIME}= Evaluate ${SLEEP_TIME} + ${SLEEP_TOLERANCE} 33 34 FOR ${i} IN RANGE 0 ${REPEATS} 35 ${r} Wait For Line On Uart Hello World! x86 36 Append To List ${l} ${r.timestamp} 37 END 38 39 FOR ${i} IN RANGE 1 ${REPEATS} 40 ${i1}= Get From List ${l} ${i - 1} 41 ${i2}= Get From List ${l} ${i} 42 ${d}= Evaluate ${i2} - ${i1} 43 Should Be True ${d} >= ${SLEEP_TIME} Too short sleep detected between entries ${i} and ${i + 1}: expected ${SLEEP_TIME}, got ${d} 44 Should Be True ${d} <= ${MAX_SLEEP_TIME} Too long sleep detected between entires ${i} and ${i + 1}: expected ${SLEEP_TIME}, got ${d} 45 END 46 47Should Run Shell 48 [Documentation] Runs Zephyr's 'shell' sample on Quark C1000 platform. 49 [Tags] zephyr uart interrupts 50 Execute Command $bin = ${URI}/shell.elf-s_392956-4b5bdd435f3d7c6555e78447438643269a87186b 51 Execute Script ${SCRIPT} 52 53 Create Terminal Tester ${UART} endLineOption=TreatCarriageReturnAsEndLine 54 Start Emulation 55 56 Wait For Prompt On Uart shell> 57 # this sleep here is to prevent against writing to soon on uart - it can happen under high stress of the host CPU - when an uart driver is not initalized which leads to irq-loop 58 Sleep 3 59 Write Line To Uart select sample_module 60 Wait For Prompt On Uart sample_module> 61 Write Line To Uart ping 62 Wait For Line On Uart pong 63 64Should Handle Gpio Button 65 [Documentation] Runs Zephyr's 'basic/button' sample on Quark C1000 platform. 66 [Tags] zephyr uart interrupts gpio button non_critical 67 Set Test Variable ${WAIT_PERIOD} 2 68 Execute Command $bin = ${URI}/button.elf-s_317524-b42765dd760d0dd260079b99724aabec2b5cf34b 69 Execute Script ${SCRIPT} 70 71 Create Terminal Tester ${UART} 72 Start Emulation 73 74 Wait For Line On Uart Press the user defined button on the board 75 Test If Uart Is Idle ${WAIT_PERIOD} 76 Execute Command gpio.button Toggle 77 Test If Uart Is Idle ${WAIT_PERIOD} 78 Execute Command gpio.button Toggle 79 Wait For Line On Uart Button pressed 80 Test If Uart Is Idle ${WAIT_PERIOD} 81 Execute Command gpio.button PressAndRelease 82 Wait For Line On Uart Button pressed 83 84Should Read Sensor 85 [Documentation] Runs antmicro's 'sensor/lm74' sample on Quark C1000 platform. 86 [Tags] zephyr uart lm74 temperature sensor spi 87 Set Test Variable ${SENSOR} spi0.lm74 88 89 Execute Command $bin = ${URI}/lm74.elf-s_397752-47a08286be251887f15b378bd3c9f0d7829e1469 90 Execute Script ${SCRIPT} 91 92 Create Terminal Tester ${UART} 93 Start Emulation 94 95 Wait For Line On Uart SPI Example application 96 Wait For Line On Uart Current temperature: 0.0 97 Execute Command ${SENSOR} Temperature 36 98 Wait For Line On Uart Current temperature: 36.0 99 100Should Talk Over Network Using Ethernet 101 [Documentation] Runs Zephyr's 'net/echo' sample on Quark C1000 platform with external ENC28J60 ethernet module. 102 [Tags] zephyr uart spi ethernet gpio 103 Set Test Variable ${REPEATS} 5 104 105 Execute Command emulation CreateSwitch "switch" 106 Execute Command $bin = ${URI}/echo_server.elf-s_684004-1ebf8c5dffefb95db60350692cf81fb7fd888869 107 Execute Command $name="quark-server" 108 Execute Script ${SCRIPT} 109 Execute Command connector Connect spi1.ethernet switch 110 111 Execute Command mach clear 112 Execute Command $bin = ${URI}/echo_client.elf-s_686384-fab5f2579652cf4bf16d68a456e6f6e4dbefbafa 113 Execute Command $name="quark-client" 114 Execute Script ${SCRIPT} 115 Execute Command connector Connect spi1.ethernet switch 116 ${mach0_tester}= Create Terminal Tester ${UART} machine=quark-server 117 ${mach1_tester}= Create Terminal Tester ${UART} machine=quark-client 118 119 Start Emulation 120 121 FOR ${i} IN RANGE 1 ${REPEATS} 122 ${r}= Evaluate random.randint(1, 50) modules=random 123 RepeatKeyword ${r} 124 ... Wait For Next Line On Uart testerId=${mach0_tester} 125 126 ${p}= Wait For Line On Uart build_reply_pkt: UDP IPv4 received (\\d+) testerId=${mach0_tester} treatAsRegex=true 127 ${n}= Wait For Next Line On Uart testerId=${mach0_tester} 128 129 Should Contain ${n.line} pkt_sent: Sent ${p.groups[0]} bytes 130 END 131 132 FOR ${i} IN RANGE 1 ${REPEATS} 133 ${r}= Evaluate random.randint(1, 50) modules=random 134 RepeatKeyword ${r} 135 ... Wait For Next Line On Uart testerId=${mach1_tester} 136 137 ${p}= Wait For Line On Uart udp_sent: IPv4: sent (\\d+) testerId=${mach1_tester} treatAsRegex=true 138 ${n}= Wait For Next Line On Uart testerId=${mach1_tester} 139 140 Should Contain ${n.line} Compared ${p.groups[0]} bytes, all ok 141 END 142