目次: Zephyr
前回はSMPに対応しました。今回はリグレッションテストを行う準備をします。
Zephyrにはsanitycheckというツールが用意されています。テストレポートやテスト用バイナリが生成されるので、Zephyrのトップディレクトリではなく、空ディレクトリを作ってから実行すると良いです。オプション -pでテストしたいプラットフォームを指定します。
$ mkdir __tmp $ cd __tmp $ sanitycheck -p qemu_riscv32 INFO - JOBS: 16 INFO - Building initial testcase list... INFO - 928 test configurations selected, 752 configurations discarded due to filters. INFO - Adding tasks to the queue... ...
いちいちsanitycheckを全部実行するとかなり時間が掛かります。テストにはタグが付いていて、sanitycheckはオプション -tで特定のタグが付いたテストのみを実行できます。便利ですね。
タグはどこから来ているかというとtestsディレクトリの下に存在するtestcase.yamlというファイルに書いてあります。
// zephyr/kernel/smp/testcase.yaml
tests:
kernel.multiprocessing.smp:
tags: smp //★これがタグ★
filter: (CONFIG_MP_NUM_CPUS > 1) //★フィルタ、この条件が真でないとテストがスキップされる★
SMP系のテストにはsmpというタグが付いているので、-t smpと指定します。
$ sanitycheck -p qemu_riscv32 -t smp INFO - JOBS: 16 INFO - Building initial testcase list... INFO - 928 test configurations selected, 925 configurations discarded due to filters. INFO - Adding tasks to the queue... INFO - Total complete: 3/ 3 100% skipped: 3, failed: 0 INFO - 0 of 0 tests passed (0.00%), 0 failed, 928 skipped with 0 warnings in 1.95 seconds INFO - In total 0 test cases were executed on 1 out of total 292 platforms (0.34%) INFO - 0 tests executed on platforms, 0 tests were only built.
残念ながらテストは全てスキップされてしまいます。原因はqemu_riscv32ボードはSMPに対応していない(CONFIG_SMPをselectしない)ため、testcase.yamlに書かれたフィルタに引っかかって除外されるからです。
先日作成したqemu_rv32_virtボードならばCONFIG_SMPが有効なので、テストが実行されるはずです。
$ sanitycheck -p qemu_rv32_virt -t smp INFO - JOBS: 16 INFO - Building initial testcase list... INFO - 0 test configurations selected, 0 configurations discarded due to filters. INFO - Adding tasks to the queue... INFO - 0 of 0 tests passed (0.00%), 0 failed, 0 skipped with 0 warnings in 0.65 seconds INFO - In total 0 test cases were executed on 0 out of total 291 platforms (0.00%) INFO - 0 tests executed on platforms, 0 tests were only built.
ダメですね。こういうときは既存のボードと見比べて差分を見るとわかりやすいです。どうやらboard.cmake, qemu_rv32_virt.yamlを作らないと、ボードが認識されないようです。
# zephyr/boards/riscv/qemu_rv32_virt/board.cmake # SPDX-License-Identifier: Apache-2.0 set(EMU_PLATFORM qemu) set(QEMU_binary_suffix riscv32)ARCH riscv32) ARCH -nographic -machine virt -cpu rv32 -bios none ) board_set_debugger_ifnset(qemu) // zephyr/boards/riscv/qemu_rv32_virt/qemu_rv32_virt.yaml identifier: qemu_rv32_virt name: QEMU RISCV32 virt target type: qemu simulation: qemu arch: riscv32 ram: 256 toolchain: - zephyr - xtools testing: default: true ignore_tags: - net - bluetooth
もう一度実行します。
$ sanitycheck -p qemu_rv32_virt -t smp INFO - JOBS: 16 INFO - Building initial testcase list... INFO - 928 test configurations selected, 925 configurations discarded due to filters. INFO - Adding tasks to the queue... ERROR - qemu_rv32_virt tests/kernel/smp/kernel.multiprocessing.smp FAILED: Timeout ERROR - see: zephyr/__tmp/sanity-out/qemu_rv32_virt/tests/kernel/smp/kernel.multiprocessing.smp/handler.log INFO - Total complete: 1/ 3 33% skipped: 0, failed: 1 ERROR - qemu_rv32_virt tests/kernel/spinlock/kernel.multiprocessing.spinlock FAILED: Failed ERROR - see: zephyr/__tmp/sanity-out/qemu_rv32_virt/tests/kernel/spinlock/kernel.multiprocessing.spinlock/handler.log INFO - Total complete: 3/ 3 100% skipped: 0, failed: 2 INFO - 1 of 3 tests passed (33.33%), 2 failed, 925 skipped with 0 warnings in 72.61 seconds INFO - In total 13 test cases were executed on 1 out of total 292 platforms (0.34%) INFO - 2 tests executed on platforms, 1 tests were only built.
いくつかのテストがFAILEDしている、すなわちデグレードしていることを示していますが、ひとまずテストは実行できました。次回はデグレードした箇所を直します。
< | 2020 | > | ||||
<< | < | 10 | > | >> | ||
日 | 月 | 火 | 水 | 木 | 金 | 土 |
- | - | - | - | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
合計:
本日:
管理者: Katsuhiro Suzuki(katsuhiro( a t )katsuster.net)
This is Simple Diary 1.0
Copyright(C) Katsuhiro Suzuki 2006-2023.
Powered by PHP 8.2.15.
using GD bundled (2.1.0 compatible)(png support.)