1
0

runTests.sh 1.0 KB

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. runCMD() { # usage: runCMD "<command>" "<retVal>"
  3. TMP_FILE=$(mktemp)
  4. eval $1 > $TMP_FILE 2>&1
  5. RETVAL=$?
  6. if [ "$RETVAL" != "$2" ]; then
  7. echo "Command ($1) returned ${RETVAL}, but expected $2. Error output:"
  8. cat $TMP_FILE
  9. exit 1
  10. fi
  11. }
  12. # Successful tests
  13. runCMD "ldd /lib/libustream-ssl.so" 0
  14. # Temporary workaround: comment out missing kmods repo line for 21.02 specifically.
  15. # Remove after fixed upstream.
  16. 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
  17. runCMD "opkg update" 0
  18. runCMD "uclient-fetch 'https://letsencrypt.org'" 0
  19. # Negative tests
  20. runCMD "uclient-fetch --ca-certificate=/dev/null 'https://letsencrypt.org'" 5
  21. runCMD "uclient-fetch 'https://self-signed.badssl.com/'" 5
  22. runCMD "uclient-fetch 'https://untrusted-root.badssl.com/'" 5
  23. runCMD "uclient-fetch 'https://expired.badssl.com/'" 5
  24. echo "All tests passed."