Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .github/workflows/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,34 @@ for PKG in /ci/*.ipk; do
exit 1
fi
else
echo "No test.sh script available"
echo "Use generic test"
PKG_FILES=$(opkg files "$PKG_NAME" | grep -E "/bin|/sbin|/usr/bin|/usr/sbin")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
PKG_FILES=$(opkg files "$PKG_NAME" | grep -E "/bin|/sbin|/usr/bin|/usr/sbin")
PKG_FILES=$(opkg files "$PKG_NAME" | grep -E "/bin|/sbin|/usr/bin|/usr/sbin")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need apk info -L support

SUCCESS=0
FOUND_EXE=0
for FILE in $PKG_FILES; do
if [ -x "$FILE" ] && [ -f "$FILE" ]; then
FOUND_EXE=1
echo "Test executable $FILE"
for V in --version -version version -v -V; do
echo "Trying $FILE $V"
if "$FILE" "$V" 2>&1 | grep "$PKG_VERSION"; then
SUCCESS=1
break
fi
done
Comment on lines +43 to +49
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think ensuring the main binary can display help should be enough for a success already, as a last resort after the version checks. This at least checks that binaries are valid and have the linked dependencies installed.

Also I think it makes sense to do grep -F if that's not the default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think ensuring the main binary can display help should be enough for a success already, as a last resort after the version checks. This at least checks that binaries are valid and have the linked dependencies installed

The problem is how? Because not all packages use exit 0 as a return. Maybe we can use grep to check the binary name itself?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I meant on top of --version -version version -v -V do something like --help, etc. Worst case scenario somebody's PR fails and they add a proper test.

Might be a good idea to also do an ldd (if it's a binary) and check if any linked dependencies are missing. And do this even if packages have their own tests.


fi
done
if [ "$FOUND_EXE" -eq 1 ]; then
if [ "$SUCCESS" -eq 0 ]; then
echo "Generic test failed"
exit 1
else
echo "Test succesful or"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be without or?

Suggested change
echo "Test succesful or"
echo "Test successful"

fi
else
echo "No executeable found in package $PKG_NAME"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
echo "No executeable found in package $PKG_NAME"
echo "No executable found in package $PKG_NAME"

fi
fi

opkg remove "$PKG_NAME" --force-removal-of-dependent-packages --force-remove
Expand Down
7 changes: 0 additions & 7 deletions utils/vim/test.sh

This file was deleted.