Skip to content

Commit

Permalink
Fix ci test report generation
Browse files Browse the repository at this point in the history
Fixes failing hw tests by running them in Renode
  • Loading branch information
jmichalski-ant committed Feb 19, 2024
1 parent 3789f12 commit aaa9f3e
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 10 deletions.
30 changes: 30 additions & 0 deletions .github/test_platform/init.resc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$name?="hifive-unleashed"

using sysbus
mach create $name
machine LoadPlatformDescription @action/device/hifive_unleashed/platform.repl

# rootfs
machine LoadPlatformDescriptionFromString 'virtio: Storage.VirtIOBlockDevice @ sysbus 0x100d0000 { IRQ -> plic@50 }'
virtio LoadImage @images/rootfs.img

machine LoadPlatformDescriptionFromString 'virtio2: Storage.VirtIOBlockDevice @ sysbus 0x100e0000 { IRQ -> plic@51 }'
virtio2 LoadImage @/home/runner/work/protoplaster/protoplaster/drive.img true


showAnalyzer uart0
e51 LogFunctionNames true

$fdt ?= @images/hifive-unleashed-a00.dtb
$elf ?= @images/fw_payload.elf
$image ?= @images/Image
$rootfs ?= @images/rootfs.cpio

macro reset
"""
sysbus LoadELF $elf
sysbus LoadFdt $fdt 0x88000000 "earlycon=sbi console=ttyS0 root=/dev/ram init=/sbin/init initrd=0x8d000000,28M"
sysbus LoadBinary $rootfs 0x8D000000
sysbus LoadBinary $image 0x8B000000
"""
runMacro $reset
Binary file not shown.
83 changes: 83 additions & 0 deletions .github/test_platform/platform.repl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Custom board - HiFive Unleashed singlecore
// Three u54 cores are disabled here to increase emulation speed

e51: CPU.RiscV64 @ sysbus
cpuType: "rv64imac"
hartId: 0
privilegeArchitecture: PrivilegeArchitecture.Priv1_10
timeProvider: clint

u54_1: CPU.RiscV64 @ sysbus
cpuType: "rv64gc"
hartId: 1
privilegeArchitecture: PrivilegeArchitecture.Priv1_10
timeProvider: clint

debug: Memory.MappedMemory @sysbus 0x0
size: 0x1000

e51DTim: Memory.MappedMemory @ sysbus 0x01000000
size: 0x2000

u54Hart1ITim: Memory.MappedMemory @ sysbus 0x01808000
size: 0x7000

clint: IRQControllers.CoreLevelInterruptor @ sysbus 0x2000000
frequency: 1000000
numberOfTargets: 2
[0, 1] -> e51@[3, 7]
[2, 3] -> u54_1@[3, 7]

plic: IRQControllers.PlatformLevelInterruptController @ sysbus 0xc000000
0 -> e51@11
[1,2] -> u54_1@[11,9]
numberOfSources: 53
numberOfContexts: 9
prioritiesEnabled : false

uart0: UART.SiFive_UART @ sysbus 0x10010000
IRQ -> plic@4

uart1: UART.SiFive_UART @ sysbus 0x10011000
IRQ -> plic@5

qspi0Flash: Memory.MappedMemory @ sysbus 0x20000000
size: 0x2000000

ddr: Memory.MappedMemory @ sysbus 0x80000000
size: 0x200000000

ethernet: Network.CadenceGEM @ sysbus 0x10090000
moduleRevision: 0x0109
moduleId: 0x1007
IRQ -> plic@53

phy: Network.EthernetPhysicalLayer @ ethernet 0
Id1: 0x0141
Id2: 0x0e40
BasicStatus: 0x62A4
AutoNegotiationAdvertisement: 0x1e1
AutoNegotiationLinkPartnerBasePageAbility: 0x1e1
MasterSlaveControl: 0x300
MasterSlaveStatus: 0x3000

qspi0: SPI.HiFive_SPI @ sysbus 0x10040000
IRQ -> plic@51
numberOfSupportedSlaves: 1

// The registration address value is taken from the device tree.
// It is different in the documentation (0x10140000).
qspi1: SPI.HiFive_SPI @ sysbus 0x10041000
IRQ -> plic@52
numberOfSupportedSlaves: 4

qspi2: SPI.HiFive_SPI @ sysbus 0x10050000
IRQ -> plic@6
numberOfSupportedSlaves: 1

pwm0: HiFive_PWM @ sysbus 0x10020000
IRQ -> plic@42

pwm1: HiFive_PWM @ sysbus 0x10021000
IRQ -> plic@46

15 changes: 15 additions & 0 deletions .github/test_platform/renode_network.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: renode_network
shell: renode
requires: [renode_config]
echo: true
timeout: 10
fail-fast: true
sleep: 0
commands:
- emulation CreateSwitch "${{SWITCH_NAME}}"
- emulation CreateTap "${{TAP_INTERFACE}}" "tap"
- connector Connect host.tap ${{SWITCH_NAME}}
- connector Connect sysbus.ethernet ${{SWITCH_NAME}}
vars:
SWITCH_NAME: switch0
TAP_INTERFACE: tap0
9 changes: 9 additions & 0 deletions .github/test_platform/v4l2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: v4l2
shell: target
before: [chroot]
echo: true
timeout: 10
fail-fast: true
disabled: false
commands:
- modprobe vivid n_devs=2 node_types=0x1,0x1 vid_cap_nr=0,2
20 changes: 16 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,22 @@ jobs:
tuttest README.md example > example.yml
protoplaster -t example.yml --generate-docs
- name: Generate test report from yml
run: |
protoplaster -t example.yml --csv report.csv
protoplaster-test-report report.csv -t md
- name: Generate test report in Renode
uses: antmicro/renode-linux-runner-action@main
with:
shared-dirs: ./
renode-run: |
python -m venv .venv
source .venv/bin/activate
pip install .
protoplaster -t example.yml --csv report.csv
protoplaster-test-report report.csv -t md
devices: |
gpio 0 32
i2c 0x3C
i2c 0x70
tasks: |
${{ github.workspace }}/.github/test_platform/v4l2.yml
- name: Generate system report from yml
run: |
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ Protoplaster expects a yaml file describing tests as an input. The yaml file sho
```yaml
base: # A group specifier
i2c: # A module specifier
- bus: 1 # An interface specifier
- bus: 0 # An interface specifier
devices: # Multiple instances of devices can be defined in one module
- name: "Sensor name"
address: 0x3c # The given device parameters determine which tests will be run for the module
- bus: 2
- bus: 0
devices:
- name: "I2C-bus multiplexer"
address: 0x70
camera:
- device: "/dev/video0"
camera_name: "Camera name"
driver_name: "Driver name"
camera_name: "vivid"
driver_name: "vivid"
- device: "/dev/video2"
camera_name: "Camera2 name"
driver_name: "Driver2 name"
camera_name: "vivid"
driver_name: "vivid"
save_file: "frame.raw"
additional:
gpio:
Expand Down

0 comments on commit aaa9f3e

Please sign in to comment.