Hi all, I'd like to propose two moves between nuttx and nuttx-apps. Both follow one rule: a component, its documentation and its tests should live in the same repository. After the move, a change and its documentation or its test are one pull request instead of two.
Numbers (last 12 months) - 133 nuttx PRs changed only the applications documentation (Documentation/applications/). At least 67 of them were explicit pairs of a nuttx-apps PR. - 198 nuttx-apps PRs changed only tests (testing/). At least 121 of them were the test for a change in nuttx. That is at least 188 pull requests a year that exist only because the code and its docs or tests are split across two repositories. Each of them is a second review, a second CI run, and a chance to merge the pair out of order. The counts are lower bounds: they include only PRs whose description links the other repository. 1. Move the applications documentation to nuttx-apps Today, Documentation/applications/ lives in nuttx, while the code it describes lives in nuttx-apps. Proposal: - move Documentation/applications/ to nuttx-apps, with its git history; - the documentation build fetches nuttx-apps at a pinned commit and includes its docs; - the published documentation records the nuttx-apps commit it was built from, for provenance. This is a few lines in the build script, and it makes every page traceable; - the documentation of the tests (Documentation/applications/testing/) does not move to nuttx-apps: it follows the tests to nuttx (see 2). 2. Move the kernel and libc tests to nuttx Today, the kernel and C library tests (ostest, the libc, fs, mm and sched tests, drivertest and the cmocka suites) live in nuttx-apps. A kernel fix and the test that proves it need two PRs. And nobody can build and run the NuttX tests from the nuttx repository alone. Other kernels keep their tests in tree: Linux has tools/testing/selftests, Zephyr has tests/. A kernel change should carry its own proof. Proposal: - move the kernel and libc tests into nuttx (for example tests/), with their git history; - move the test frameworks they use (cmocka, unity, fff) with them, with their licenses and NOTICE entries; - add the build support so a configuration can build and run the tests without nuttx-apps, in both the Make and CMake builds, flat and kernel builds (for example a test runner as the init entry point). This is the largest part of the work; - tests of the apps themselves (nsh and so on) stay in nuttx-apps. Kconfig The test options keep their names (CONFIG_TESTING_*), because 729 board defconfigs use them (616 enable CONFIG_TESTING_OSTEST). Only their menu moves, from nuttx-apps' "Testing" menu to a "Tests" menu sourced from nuttx/Kconfig. Each pair of PRs lands the same day, so no option is ever defined twice. tools/kconfig2html and tools/checkkconfig.py will cover the new directory. How the moves are done Each move is a pair of PRs, one in each repository, merged the same day so the files are never missing or duplicated: - The "add" PR in the target repository carries the full history. It's made with git filter-repo: a clone of the source repository keeps only the moved directory and its history, and is merged into the target with git merge --allow-unrelated-histories. Then git log and git blame in the new place show the original commits, authors and dates. - The "remove" PR in the source repository deletes the directory and names the commit in the target repository where the files now live. One request to the PMC: history survives only if that merge commit lands as it is. A squash loses the history, and a rebase replays hundreds of old commits onto master. So I'd ask that each "add" PR be merged with a merge commit, either by allowing merge commits for these PRs or by a committer pushing the reviewed merge. If that's not acceptable, the fallback is a plain add in one commit whose message names the source repository and commit, where the full history stays available. Other work involved - Documentation build: read the applications docs from nuttx-apps, and record its commit hash. - CI: build and run the tests from the nuttx checkout, and update the test lists, the labeler rules, CODEOWNERS and the checkpatch paths. - Transition: for one release, leave a short pointer in each old place, so open PRs and out-of-tree users have time to move. Phasing I suggest we start with the documentation, which is small and easy to revert. Then we move the tests one directory at a time, starting with ostest. For later discussion (not part of this proposal) If the tests can run without nuttx-apps, it's worth asking whether a minimal init (and possibly nsh) belongs in nuttx too, so that a nuttx checkout boots to something useful on its own. I'd like to keep that separate. I'm happy to do the work and send the PRs. Comments and objections welcome, especially from those who maintain the documentation build and the CI.de Thanks, Marco
