1
0

async-check.sh 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. # async-check.sh
  3. # This script creates symbolic links to the required asynchronous
  4. # file for using the asynchronous simulator and make check
  5. #
  6. # $ ./async-check [keep]
  7. #
  8. # - keep: (default off) ./async and links kept around for inspection
  9. #
  10. function Usage() {
  11. printf '\n%s\n' "Usage: $0 [keep]"
  12. printf '\n%s\n\n' "Where \"keep\" means keep (default off) async files around for inspection"
  13. printf '%s\n' "EXAMPLE:"
  14. printf '%s\n' "---------------------------------"
  15. printf '%s\n' "./async-check.sh keep"
  16. printf '%s\n\n' "---------------------------------"
  17. }
  18. ASYNC_REPO=git@github.com:wolfSSL/wolfAsyncCrypt.git
  19. #ASYNC_REPO=../wolfAsyncCrypt
  20. # Optionally keep async files
  21. if [ "x$1" == "xkeep" ]; then KEEP="yes"; else KEEP="no"; fi
  22. if [ -d ./async ];
  23. then
  24. echo "\n\nUsing existing async repo\n\n"
  25. else
  26. # make a clone of the wolfAsyncCrypt repository
  27. git clone $ASYNC_REPO async
  28. [ $? -ne 0 ] && echo "\n\nCouldn't checkout the wolfAsyncCrypt repository\n\n" && exit 1
  29. fi
  30. # setup auto-conf
  31. ./autogen.sh
  32. # link files
  33. ln -s -F ../../async/wolfcrypt/src/async.c ./wolfcrypt/src/async.c
  34. ln -s -F ../../async/wolfssl/wolfcrypt/async.h ./wolfssl/wolfcrypt/async.h
  35. ln -s -F ../../../../async/wolfcrypt/src/port/intel/quickassist.c ./wolfcrypt/src/port/intel/quickassist.c
  36. ln -s -F ../../../../async/wolfcrypt/src/port/intel/quickassist_mem.c ./wolfcrypt/src/port/intel/quickassist_mem.c
  37. ln -s -F ../../../../async/wolfcrypt/src/port/intel/README.md ./wolfcrypt/src/port/intel/README.md
  38. ln -s -F ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist.h ./wolfssl/wolfcrypt/port/intel/quickassist.h
  39. ln -s -F ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist_mem.h ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h
  40. ln -s -F ../../../../async/wolfcrypt/src/port/cavium/cavium_nitrox.c ./wolfcrypt/src/port/cavium/cavium_nitrox.c
  41. ln -s -F ../../../../async/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
  42. ln -s -F ../../../../async/wolfcrypt/src/port/cavium/README.md ./wolfcrypt/src/port/cavium/README.md
  43. ./configure --enable-asynccrypt --enable-all
  44. make check
  45. [ $? -ne 0 ] && echo "\n\nMake check failed. Debris left for analysis." && exit 1
  46. # Clean up
  47. popd
  48. if [ "x$KEEP" == "xno" ];
  49. then
  50. unlink ./wolfcrypt/src/async.c
  51. unlink ./wolfssl/wolfcrypt/async.h
  52. unlink ./wolfcrypt/src/port/intel/quickassist.c
  53. unlink ./wolfcrypt/src/port/intel/quickassist_mem.c
  54. unlink ./wolfcrypt/src/port/intel/README.md
  55. unlink ./wolfssl/wolfcrypt/port/intel/quickassist.h
  56. unlink ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h
  57. unlink ./wolfcrypt/src/port/cavium/cavium_nitrox.c
  58. unlink ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
  59. unlink ./wolfcrypt/src/port/cavium/README.md
  60. rm -rf ./async
  61. # restore original README.md files
  62. git checkout -- wolfcrypt/src/port/cavium/README.md
  63. git checkout -- wolfcrypt/src/port/intel/README.md
  64. fi