You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

  1. #!/bin/sh
  2. mkdir -p /var/lock/
  3. opkg update
  4. [ -n "$CI_HELPER" ] || CI_HELPER="/ci/.github/workflows/ci_helpers.sh"
  5. for PKG in /ci/*.ipk; do
  6. tar -xzOf "$PKG" ./control.tar.gz | tar xzf - ./control
  7. # package name including variant
  8. PKG_NAME=$(sed -ne 's#^Package: \(.*\)$#\1#p' ./control)
  9. # package version without release
  10. PKG_VERSION=$(sed -ne 's#^Version: \(.*\)-[0-9]*$#\1#p' ./control)
  11. # package source contianing test.sh script
  12. PKG_SOURCE=$(sed -ne 's#^Source: .*/\(.*\)$#\1#p' ./control)
  13. echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
  14. opkg install "$PKG"
  15. export PKG_NAME PKG_VERSION CI_HELPER
  16. TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/test.sh
  17. if [ -f "$TEST_SCRIPT" ]; then
  18. echo "Use package specific test.sh"
  19. if sh "$TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
  20. echo "Test succesful"
  21. else
  22. echo "Test failed"
  23. exit 1
  24. fi
  25. else
  26. echo "No test.sh script available"
  27. fi
  28. opkg remove "$PKG_NAME" --force-removal-of-dependent-packages --force-remove
  29. done