1
0

async-check.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/bin/bash
  2. # This script creates symbolic links to the required asynchronous
  3. # file for using the asynchronous simulator and make check
  4. # Fail on any error in script
  5. set -e
  6. ASYNC_REPO=https://github.com/wolfSSL/wolfAsyncCrypt.git
  7. ASYNC_DIR=${ASYNC_DIR:-wolfAsyncCrypt}
  8. function Usage() {
  9. printf "Usage: $0 [install|uninstall|test|remove]\n"
  10. printf "\tinstall - get and set up links to wolfAsyncCrypt files\n"
  11. printf "\tuninstall - remove the links to wolfAsyncCrypt\n"
  12. printf "\ttest - install and run 'make check'\n"
  13. printf "\tremove - uninstall and remove wolfAsyncCrypt\n"
  14. }
  15. function UnlinkFiles() {
  16. unlink ./wolfcrypt/src/async.c
  17. unlink ./wolfssl/wolfcrypt/async.h
  18. unlink ./wolfcrypt/src/port/intel/quickassist.c
  19. unlink ./wolfcrypt/src/port/intel/quickassist_mem.c
  20. unlink ./wolfcrypt/src/port/intel/README.md
  21. unlink ./wolfssl/wolfcrypt/port/intel/quickassist.h
  22. unlink ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h
  23. unlink ./wolfcrypt/src/port/cavium/cavium_nitrox.c
  24. unlink ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
  25. unlink ./wolfcrypt/src/port/cavium/README.md
  26. # restore original README.md files
  27. git checkout -- wolfcrypt/src/port/cavium/README.md
  28. git checkout -- wolfcrypt/src/port/intel/README.md
  29. }
  30. function LinkFiles() {
  31. # link files
  32. ln -s -f ../../${ASYNC_DIR}/wolfcrypt/src/async.c ./wolfcrypt/src/async.c
  33. ln -s -f ../../${ASYNC_DIR}/wolfssl/wolfcrypt/async.h ./wolfssl/wolfcrypt/async.h
  34. ln -s -f ../../../../${ASYNC_DIR}/wolfcrypt/src/port/intel/quickassist.c ./wolfcrypt/src/port/intel/quickassist.c
  35. ln -s -f ../../../../${ASYNC_DIR}/wolfcrypt/src/port/intel/quickassist_mem.c ./wolfcrypt/src/port/intel/quickassist_mem.c
  36. ln -s -f ../../../../${ASYNC_DIR}/wolfcrypt/src/port/intel/README.md ./wolfcrypt/src/port/intel/README.md
  37. ln -s -f ../../../../${ASYNC_DIR}/wolfssl/wolfcrypt/port/intel/quickassist.h ./wolfssl/wolfcrypt/port/intel/quickassist.h
  38. ln -s -f ../../../../${ASYNC_DIR}/wolfssl/wolfcrypt/port/intel/quickassist_mem.h ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h
  39. ln -s -f ../../../../${ASYNC_DIR}/wolfcrypt/src/port/cavium/cavium_nitrox.c ./wolfcrypt/src/port/cavium/cavium_nitrox.c
  40. ln -s -f ../../../../${ASYNC_DIR}/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
  41. ln -s -f ../../../../${ASYNC_DIR}/wolfcrypt/src/port/cavium/README.md ./wolfcrypt/src/port/cavium/README.md
  42. }
  43. function Install() {
  44. if [ -d $ASYNC_DIR ];
  45. then
  46. echo "Using existing async repo"
  47. else
  48. # make a clone of the wolfAsyncCrypt repository
  49. git clone --depth 1 $ASYNC_REPO $ASYNC_DIR
  50. fi
  51. # setup auto-conf
  52. ./autogen.sh
  53. LinkFiles
  54. }
  55. function Uninstall() {
  56. UnlinkFiles
  57. }
  58. function Test() {
  59. Install
  60. ./configure --enable-asynccrypt --enable-all
  61. make check
  62. }
  63. function Remove() {
  64. UnlinkFiles
  65. rm -rf ${ASYNC_DIR}
  66. }
  67. if [ "$#" -gt 1 ]; then
  68. Usage
  69. exit 1
  70. fi
  71. case "x$1" in
  72. "xinstall")
  73. Install
  74. ;;
  75. "xuninstall")
  76. Uninstall
  77. ;;
  78. "xremove")
  79. Remove
  80. ;;
  81. "xtest")
  82. Test
  83. ;;
  84. *)
  85. Usage
  86. exit 1
  87. ;;
  88. esac