Skip to content

Conversation

@GeorgeSapkin
Copy link
Member

@GeorgeSapkin GeorgeSapkin commented Nov 4, 2025

Add generic version tests based on openwrt/packages#13589 and openwrt/packages#13785.

When a package-specific test is not present:

  • Check if any of the package executables return the expected version when called with a generic list of flags, e.g. --version, -v, etc.
  • Check if executable and library symlinks are valid.
  • Check if executables are marked as such.
  • Check for hardcoded paths.
  • Check if binaries are stripped.
  • Check if all shared linked libraries are installed.
  • Check if libraries have sonames and if so, if they have a soname symlink.

Unify Dockerfile and script paths.
Add ci_helpers through the Dockerfile.
Change CI_HELPER to CI_HELPERS. This doesn't seem to be used anywhere outside of this repo at the moment.
Remove unused dockerfiles_feeds and helper volumes.

Sample output:

image

Note

Doesn't address the xxd issue (i.e. the test fails) where the binary has a different version from the package.
This can be addressed either by adding a package-specific test or setting a sub-package version.

Example main/apk job: https://github.com/GeorgeSapkin/openwrt-packages/actions/runs/19636812537/job/56229491345?pr=12#step:17:54

I took the liberty to improve the readability of the script a bit.

CC: @aparcar, @BKPepe, @wehagy

@GeorgeSapkin GeorgeSapkin marked this pull request as draft November 5, 2025 18:28
@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch from d9a5fd2 to 919e360 Compare November 5, 2025 19:54
@GeorgeSapkin GeorgeSapkin changed the title entrypoint: add generic version tests multi-arch-test-build: add generic version tests Nov 5, 2025
@GeorgeSapkin GeorgeSapkin marked this pull request as ready for review November 5, 2025 19:58
@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch 4 times, most recently from 99db061 to 22e2dc6 Compare November 5, 2025 22:59
@GeorgeSapkin GeorgeSapkin changed the title multi-arch-test-build: add generic version tests multi-arch-test-build: add generic version tests and unify file paths Nov 5, 2025
@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch from 22e2dc6 to ef0a278 Compare November 5, 2025 23:02
@BKPepe
Copy link
Member

BKPepe commented Nov 12, 2025

@Ansuel what do you think about this? :)

@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch from ef0a278 to fa95e6a Compare November 12, 2025 20:54
@BKPepe
Copy link
Member

BKPepe commented Nov 13, 2025

And it looks like @cotequeiroz might be interested in this as well as he fiddles with CI test in openwrt/packages#27867

@cotequeiroz
Copy link
Member

News travel fast here. You can say I'm a big fan of this.

@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch from fa95e6a to 12b3785 Compare November 14, 2025 16:00
@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch from 12b3785 to 0dc230a Compare November 24, 2025 14:08
@GeorgeSapkin GeorgeSapkin changed the title multi-arch-test-build: add generic version tests and unify file paths multi-arch-test-build: add generic package tests Nov 24, 2025
@GeorgeSapkin
Copy link
Member Author

GeorgeSapkin commented Nov 24, 2025

I've reworked the script and added more executable and library checks:

  • Check if executable and library symlinks are valid.
  • Check if executables are marked as such.
  • Check for hardcoded paths.
  • Check if binaries are stripped.
  • Check if all shared linked libraries are installed.
  • Check if libraries have sonames and if so, if they have a soname symlink.

I suppose there could be either a per-feed and/or a per-package switch whether these tests should run. Potentially on top of the package-specific tests.

@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch from 0dc230a to 09baac7 Compare November 24, 2025 14:11
@GeorgeSapkin GeorgeSapkin marked this pull request as draft November 25, 2025 00:39
@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch from 09baac7 to ec3b743 Compare November 25, 2025 00:40
@GeorgeSapkin GeorgeSapkin marked this pull request as ready for review November 25, 2025 00:41
@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch 3 times, most recently from d96f4df to c66b035 Compare December 2, 2025 14:46
Use same path structure to other workflows for Dockerfile and script.

Add ci_helpers through the Dockerfile.
Change CI_HELPER to CI_HELPERS
Remove unused volume.

Signed-off-by: George Sapkin <[email protected]>
Check if any of the package executables return the expected version when
called with a generic list of flags, e.g. --version, -v, etc.

Check if executable and library symlinks are valid.

Check if executables are marked as such.

Check for hardcoded paths.

Check if binaries are stripped.

Check if all shared linked libraries are installed.

Check if libraries have sonames and if so, if they have a soname
symlink.

Generic tests are both enabled and forced by default, i.e. they will run
even if a package-specific test is present.

Signed-off-by: George Sapkin <[email protected]>
@GeorgeSapkin GeorgeSapkin force-pushed the entrypoint-add-generic-version-tests branch from c66b035 to 462d26a Compare December 2, 2025 17:38
@BKPepe
Copy link
Member

BKPepe commented Dec 29, 2025

Whoa, looks like it's ready and just needs merging, right? Review would be nice, but no one’s touched it in a month. It’d be awesome to get this merged, I could really use it right now.

export PKG_NAME PKG_VERSION CI_HELPERS

if [ -f "$PRE_TEST_SCRIPT" ]; then
info 'Use the package-specific pre-test.sh'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
info 'Use the package-specific pre-test.sh'
info 'Running package-specific pre-test script'

Copy link
Member Author

Choose a reason for hiding this comment

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

Same comment as above regarding string phrasing. I don't have a strong feeling about these though.

SUCCESS=0

if generic_tests_enabled && ( generic_tests_forced || [ ! -f "$TEST_SCRIPT" ] ); then
warn 'Use generic tests'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
warn 'Use generic tests'
warn 'Running generic tests'

fi

if [ -f "$TEST_SCRIPT" ]; then
info 'Use the package-specific test.sh'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
info 'Use the package-specific test.sh'
info 'Using the package-specific test.sh'

mkdir -p /var/lock/
mkdir -p /var/log/

CI_HELPERS="${CI_HELPERS:-/scripts/ci_helpers.sh}"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can add something like this?

if [ ! -f "$CI_HELPERS" ]; then
	echo "ERROR: CI helpers file not found: $CI_HELPERS" >&2
	exit 1
fi


for PKG in /ci/*.[ai]pk; do
if is_opkg; then
tar -xzOf "$PKG" ./control.tar.gz | tar xzf - ./control
Copy link
Member

Choose a reason for hiding this comment

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

What if tar fails to extract it?

Copy link
Member Author

@GeorgeSapkin GeorgeSapkin Dec 30, 2025

Choose a reason for hiding this comment

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

Most of the script is from before. GH UI for some reason doesn't show that this file was moved. So I didn't modify anything unrelated.

Copy link
Member

Choose a reason for hiding this comment

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

Oh... yeah, it is quite confusing. :-/ Would be easier to review things, which we can see what you modified/added/changed, but I will prepare PR against your repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants