Skip to content

examples/elf: extend nxpkg validation coverage#3531

Open
aviralgarg05 wants to merge 1 commit into
apache:masterfrom
aviralgarg05:gsoc/elf-validation-fixtures-pr4
Open

examples/elf: extend nxpkg validation coverage#3531
aviralgarg05 wants to merge 1 commit into
apache:masterfrom
aviralgarg05:gsoc/elf-validation-fixtures-pr4

Conversation

@aviralgarg05

Copy link
Copy Markdown
Contributor

Summary

This patch is another smaller upstream slice being extracted from the ongoing GSoC 2026 Dynamic ELF loading and nxpkg work for NuttX.

An earlier draft PR (#3474) carries the initial nxpkg package lifecycle helper. This PR is the examples/elf validation-fixture follow-up from the same broader effort.

Series order for this PR:

The change extends the examples/elf ROMFS path so nxpkg validation can use generated package fixtures instead of hand-managed metadata.

Concretely, it:

  • generates index.json, bad-index.json, pkgtest.nsh, and pkgfail.nsh from the built hello ELF
  • records the correct target arch / compat metadata and SHA-256 digest for the valid fixture
  • keeps mismatched-target and missing-artifact cases alongside the valid fixture so nxpkg target selection and failure handling can be exercised from the same example tree
  • groups the paired fixture outputs in one make step so parallel builds do not re-enter the generator independently

Impact

This makes the examples/elf side of the Dynamic ELF / nxpkg series easier to validate and reproduce.

It keeps the fixture metadata tied to the actual built hello artifact, instead of relying on manually maintained hashes or ad hoc shell setup. That should make follow-up review and later test reruns more predictable.

There is no intended loader or board-behavior change in this patch. It is limited to fixture generation inside examples/elf.

Testing

Host:

  • macOS 26.5
  • Apple Silicon (arm64)
  • xtensa-esp-elf-gcc (crosstool-NG esp-14.2.0_20241119) 14.2.0
  • esptool.py v4.11.0

Focused stacked verification for this PR:

  • clean detached apps worktree at the current #3474 head, with this two-file patch applied
  • clean detached companion apache/nuttx worktree at local 294d6d2763 (boards/xtensa/esp32s3/xiao:sotest: enable nxpkg fixtures), which carries the matching esp32s3-xiao:elf configuration used for the series
  • target: xtensa
  • config: esp32s3-xiao:elf

Build steps:

./tools/configure.sh -E -a ../apps esp32s3-xiao:elf
make olddefconfig
make -j8

Generated fixture artifacts:

bin/index.json
bin/bad-index.json
bin/pkgtest.nsh
bin/pkgfail.nsh

Build result:

LD: nuttx
CP: nuttx.hex
MKIMAGE: ESP32-S3 binary
Generated: nuttx.bin

Branch sanity build:

  • the same companion apache/nuttx worktree was also paired directly with this PR branch to confirm the slice still builds cleanly outside the stacked #3474 setup

Sanity-build result:

LD: nuttx
CP: nuttx.hex
MKIMAGE: ESP32-S3 binary
Generated: nuttx.bin

@aviralgarg05 aviralgarg05 force-pushed the gsoc/elf-validation-fixtures-pr4 branch 2 times, most recently from c180ecf to 04e17b4 Compare June 13, 2026 16:32
@aviralgarg05 aviralgarg05 marked this pull request as ready for review June 21, 2026 14:55
@aviralgarg05 aviralgarg05 force-pushed the gsoc/elf-validation-fixtures-pr4 branch from 04e17b4 to 4429450 Compare June 21, 2026 14:57

@acassis acassis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aviralgarg05 please test CMake as well, NuttX used both building systems

@aviralgarg05 aviralgarg05 force-pushed the gsoc/elf-validation-fixtures-pr4 branch 2 times, most recently from bf8be7a to 7f20e7e Compare June 22, 2026 13:52
acassis
acassis previously approved these changes Jun 22, 2026
@acassis

acassis commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 PTAL

@aviralgarg05

Copy link
Copy Markdown
Contributor Author

This PR is ready to merge :)

@linguini1 linguini1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change enforces that the user has Python as part of the build system, which I remember was a contentious issue.

Also, is the elf example not different from the nxpkg application? I don't think we should be generating nxpkg test artifacts from the elf example. It would be better to include those under some test/ directory.

@acassis

acassis commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

@aviralgarg05 please convert these tools to C, I think it is safer

@aviralgarg05

Copy link
Copy Markdown
Contributor Author

I pushed an update for this.

The Python generators added by this PR are gone now. The fixture helper is now a small C host tool, and the CMake path uses the existing in-tree tooling style instead of introducing new Python build steps.

I kept the fixture under examples/elf because it is validating the hello artifact produced by that example itself, but if you still want that split into a dedicated test location, I can do that as a follow-up.

@linguini1 linguini1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squash your commits.

@aviralgarg05 aviralgarg05 force-pushed the gsoc/elf-validation-fixtures-pr4 branch from 968d537 to 781be36 Compare July 7, 2026 18:50
Extend the examples/elf ROMFS path so nxpkg validation can use
generated package fixtures instead of hand-managed metadata.

Generate index.json, bad-index.json, pkgtest.nsh, and pkgfail.nsh
from the built hello ELF, recording the correct target arch/compat
metadata and SHA-256 digest for the valid fixture. Keep mismatched-
target and missing-artifact cases alongside the valid fixture so
nxpkg target selection and failure handling can be exercised from
the same example tree. Group the paired fixture outputs in one make
step so parallel builds do not re-enter the generator independently.

This keeps the fixture metadata tied to the actual built hello
artifact instead of relying on manually maintained hashes or ad hoc
shell setup, making follow-up review and later test reruns more
predictable. There is no intended loader or board-behavior change;
this is limited to fixture generation inside examples/elf.

Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
@aviralgarg05 aviralgarg05 force-pushed the gsoc/elf-validation-fixtures-pr4 branch from 14f6e92 to 8ef5065 Compare July 11, 2026 16:28
@aviralgarg05 aviralgarg05 requested a review from linguini1 July 12, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants