|
| 1 | +============= |
| 2 | +``select.py`` |
| 3 | +============= |
| 4 | + |
| 5 | +This tool is written in Python and is intended to run as part of the CI |
| 6 | +workflow. The primary purpose of this tool is to map a set of changed files to a |
| 7 | +set of ``defconfig`` files (NuttX configurations) for build testing. The number |
| 8 | +of selected ``defconfig`` files should be the minimum possible for full build |
| 9 | +coverage. |
| 10 | + |
| 11 | +Examples |
| 12 | +======== |
| 13 | + |
| 14 | +For now, any files that are modified outside of the ``arch/`` and ``board/`` |
| 15 | +directories require a build of every in-tree configuration. This is because |
| 16 | +there is currently no method of detecting which configurations are dependent on |
| 17 | +which source files. A modified driver could be included anywhere (although in |
| 18 | +practice, things like sensor drivers are probably in <10 configurations, so this |
| 19 | +is wasteful). |
| 20 | + |
| 21 | +.. code:: console |
| 22 | +
|
| 23 | + $ tools/ci/build-selector/select.py drivers/sensors/lis2dh.c |
| 24 | + boards/x86/qemu/qemu-i486/configs/ostest/defconfig |
| 25 | + boards/x86/qemu/qemu-i486/configs/nsh/defconfig |
| 26 | + boards/or1k/mor1kx/or1k/configs/nsh/defconfig |
| 27 | + boards/x86_64/qemu/qemu-intel64/configs/ostest/defconfig |
| 28 | + boards/x86_64/qemu/qemu-intel64/configs/jumbo/defconfig |
| 29 | + boards/x86_64/qemu/qemu-intel64/configs/nsh_pci/defconfig |
| 30 | + boards/x86_64/qemu/qemu-intel64/configs/fb/defconfig |
| 31 | + boards/x86_64/qemu/qemu-intel64/configs/nsh_pci_smp/defconfig |
| 32 | + boards/x86_64/qemu/qemu-intel64/configs/nsh/defconfig |
| 33 | + boards/x86_64/qemu/qemu-intel64/configs/lvgl/defconfig |
| 34 | + ... |
| 35 | + # Full output omitted for brevity! |
| 36 | +
|
| 37 | +If only a single ``defconfig`` file is modified, it is the only file that should |
| 38 | +be built! |
| 39 | + |
| 40 | +.. code:: console |
| 41 | +
|
| 42 | + $ tools/ci/build-selector/select.py boards/arm64/bcm2711/raspberrypi-4b/configs/nsh/defconfig |
| 43 | + boards/arm64/bcm2711/raspberrypi-4b/configs/nsh/defconfig |
| 44 | +
|
| 45 | +If only a single board has modifications, we should build only ``defconfig`` |
| 46 | +files associated with that board. |
| 47 | + |
| 48 | +.. code:: console |
| 49 | +
|
| 50 | + $ tools/ci/build-selector/select.py boards/arm64/bcm2711/raspberrypi-4b/src/bcm2711_i2cdev.c |
| 51 | + boards/arm64/bcm2711/raspberrypi-4b/configs/ostest/defconfig |
| 52 | + boards/arm64/bcm2711/raspberrypi-4b/configs/sd/defconfig |
| 53 | + boards/arm64/bcm2711/raspberrypi-4b/configs/fb/defconfig |
| 54 | + boards/arm64/bcm2711/raspberrypi-4b/configs/nsh/defconfig |
| 55 | + boards/arm64/bcm2711/raspberrypi-4b/configs/lvgl/defconfig |
| 56 | + boards/arm64/bcm2711/raspberrypi-4b/configs/cgol/defconfig |
| 57 | + boards/arm64/bcm2711/raspberrypi-4b/configs/coremark/defconfig |
| 58 | +
|
| 59 | +If only a single chip has modifications, then all ``defconfig`` files associated |
| 60 | +with that chip should be built. |
| 61 | + |
| 62 | +.. code:: console |
| 63 | +
|
| 64 | + $ tools/ci/build-selector/select.py arch/arm64/src/bcm2711/bcm2711_mailbox.c |
| 65 | + boards/arm64/bcm2711/raspberrypi-4b/configs/ostest/defconfig |
| 66 | + boards/arm64/bcm2711/raspberrypi-4b/configs/sd/defconfig |
| 67 | + boards/arm64/bcm2711/raspberrypi-4b/configs/fb/defconfig |
| 68 | + boards/arm64/bcm2711/raspberrypi-4b/configs/nsh/defconfig |
| 69 | + boards/arm64/bcm2711/raspberrypi-4b/configs/lvgl/defconfig |
| 70 | + boards/arm64/bcm2711/raspberrypi-4b/configs/cgol/defconfig |
| 71 | + boards/arm64/bcm2711/raspberrypi-4b/configs/coremark/defconfig |
| 72 | +
|
| 73 | +And finally, if an architecture undergoes a modification, all ``defconfig`` |
| 74 | +files associated with that architecture should be built. |
| 75 | + |
| 76 | +.. code:: console |
| 77 | +
|
| 78 | + $ tools/ci/build-selector/select.py arch/arm64/Kconfig |
| 79 | + boards/arm64/bcm2711/raspberrypi-4b/configs/ostest/defconfig |
| 80 | + boards/arm64/bcm2711/raspberrypi-4b/configs/sd/defconfig |
| 81 | + boards/arm64/bcm2711/raspberrypi-4b/configs/fb/defconfig |
| 82 | + boards/arm64/bcm2711/raspberrypi-4b/configs/nsh/defconfig |
| 83 | + boards/arm64/bcm2711/raspberrypi-4b/configs/lvgl/defconfig |
| 84 | + boards/arm64/bcm2711/raspberrypi-4b/configs/cgol/defconfig |
| 85 | + boards/arm64/bcm2711/raspberrypi-4b/configs/coremark/defconfig |
| 86 | + boards/arm64/rk3399/pinephonepro/configs/nsh/defconfig |
| 87 | + boards/arm64/rk3399/nanopi_m4/configs/nsh/defconfig |
| 88 | + boards/arm64/a64/pinephone/configs/sensor/defconfig |
| 89 | + boards/arm64/a64/pinephone/configs/nsh/defconfig |
| 90 | + boards/arm64/a64/pinephone/configs/lvgl/defconfig |
| 91 | + boards/arm64/a64/pinephone/configs/lcd/defconfig |
| 92 | + boards/arm64/qemu/qemu-armv8a/configs/fastboot/defconfig |
| 93 | + boards/arm64/qemu/qemu-armv8a/configs/netnsh/defconfig |
| 94 | + boards/arm64/qemu/qemu-armv8a/configs/sotest/defconfig |
| 95 | + boards/arm64/qemu/qemu-armv8a/configs/citest_smp/defconfig |
| 96 | + boards/arm64/qemu/qemu-armv8a/configs/mte/defconfig |
| 97 | + boards/arm64/qemu/qemu-armv8a/configs/nsh_gicv2/defconfig |
| 98 | + boards/arm64/qemu/qemu-armv8a/configs/netnsh_hv/defconfig |
| 99 | + boards/arm64/qemu/qemu-armv8a/configs/sw_tags/defconfig |
| 100 | + boards/arm64/qemu/qemu-armv8a/configs/rpserver/defconfig |
| 101 | + boards/arm64/qemu/qemu-armv8a/configs/nsh_smp_tickless/defconfig |
| 102 | + boards/arm64/qemu/qemu-armv8a/configs/netnsh_smp_hv/defconfig |
| 103 | + boards/arm64/qemu/qemu-armv8a/configs/fb/defconfig |
| 104 | + boards/arm64/qemu/qemu-armv8a/configs/xedge_demo/defconfig |
| 105 | + boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig |
| 106 | + # remaining configurations omitted for brevity |
| 107 | +
|
| 108 | +
|
| 109 | +This tool can also handle any combinations of the above; it always selects the |
| 110 | +minimum defconfigs for the change set. For instance, modifying ``rp23xx`` common |
| 111 | +logic and a Raspberry Pi 4B configuration: |
| 112 | + |
| 113 | +.. code:: console |
| 114 | +
|
| 115 | + $ tools/ci/build-selector/select.py arch/arm/src/rp23xx/rp23xx_idle.c boards/arm64/bcm2711/raspberrypi-4b/configs/sd/defconfig |
| 116 | + boards/arm/rp23xx/raspberrypi-pico-2/configs/spisd/defconfig |
| 117 | + boards/arm/rp23xx/raspberrypi-pico-2/configs/nsh/defconfig |
| 118 | + boards/arm/rp23xx/raspberrypi-pico-2/configs/userled/defconfig |
| 119 | + boards/arm/rp23xx/raspberrypi-pico-2/configs/usbnsh/defconfig |
| 120 | + boards/arm/rp23xx/raspberrypi-pico-2/configs/smp/defconfig |
| 121 | + boards/arm/rp23xx/pimoroni-pico-2-plus/configs/audiopack/defconfig |
| 122 | + boards/arm/rp23xx/pimoroni-pico-2-plus/configs/nsh/defconfig |
| 123 | + boards/arm/rp23xx/pimoroni-pico-2-plus/configs/nshsram/defconfig |
| 124 | + boards/arm/rp23xx/pimoroni-pico-2-plus/configs/userled/defconfig |
| 125 | + boards/arm/rp23xx/pimoroni-pico-2-plus/configs/composite/defconfig |
| 126 | + boards/arm/rp23xx/pimoroni-pico-2-plus/configs/usbmsc/defconfig |
| 127 | + boards/arm/rp23xx/pimoroni-pico-2-plus/configs/usbnsh/defconfig |
| 128 | + boards/arm/rp23xx/pimoroni-pico-2-plus/configs/smp/defconfig |
| 129 | + boards/arm/rp23xx/xiao-rp2350/configs/combo/defconfig |
| 130 | + boards/arm/rp23xx/xiao-rp2350/configs/nsh/defconfig |
| 131 | + boards/arm/rp23xx/xiao-rp2350/configs/usbnsh/defconfig |
| 132 | + boards/arm64/bcm2711/raspberrypi-4b/configs/sd/defconfig |
0 commit comments