runTests.sh 1.1 KB

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. runCMD() { # usage: runCMD "<command>" "<retVal>"
  3. eval $1 >/dev/null 2>&1
  4. RETVAL=$?
  5. if [ "$RETVAL" != "$2" ]; then
  6. echo "Command ($1) returned ${RETVAL}, but expected $2. Rerunning with output to terminal:"
  7. eval $1
  8. exit 1
  9. fi
  10. }
  11. # Successful tests
  12. runCMD "ldd /lib/libustream-ssl.so" 0
  13. # Temporary workaround: comment out missing kmods repo line for 21.02 specifically.
  14. # Remove after fixed upstream.
  15. runCMD "sed '\/src\/gz openwrt_kmods https:\/\/downloads.openwrt.org\/releases\/21.02-SNAPSHOT\/targets\/x86\/64\/kmods\/5.4.238-1-5a722da41bc36de95a7195be6fce1b45/s//#&/' -i /etc/opkg/distfeeds.conf" 0
  16. runCMD "opkg update" 0
  17. runCMD "uclient-fetch -O /dev/null 'https://letsencrypt.org'" 0
  18. # Negative tests
  19. runCMD "uclient-fetch --ca-certificate=/dev/null -O /dev/null 'https://letsencrypt.org'" 5
  20. runCMD "uclient-fetch -O /dev/null 'https://self-signed.badssl.com/'" 5
  21. runCMD "uclient-fetch -O /dev/null 'https://untrusted-root.badssl.com/'" 5
  22. runCMD "uclient-fetch -O /dev/null 'https://expired.badssl.com/'" 5
  23. echo "All tests passed."