smoke_test.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/sh
  2. #This file left here only for reference
  3. #Actual script have to be run via CTest as
  4. #`ctest -L API`. It will prepare the index with indexer,
  5. # and then run smoke as here.
  6. #
  7. # Actual related fileas are CMakeLists.txt and smoke.cmake
  8. [ "z$FAILLOG" = "z" ] && FAILLOG="/tmp/faillog"
  9. DIFF='smoke_diff.txt'
  10. RES='smoke_test.txt'
  11. REF='smoke_ref.txt'
  12. SHELL='/bin/sh'
  13. LINE='-----------------------------\n'
  14. die()
  15. {
  16. cat $FAILLOG
  17. echo $LINE
  18. [ ! "z$2" = "z" ] && { eval $2; echo "$LINE"; }
  19. echo "C API:$1"
  20. [ -e "$FAILLOG" ] && rm $FAILLOG
  21. stop="../../src/searchd -c smoke_test.conf --stop"
  22. echo "Executing: $stop\n">$FAILLOG
  23. eval "$stop" 1>>$FAILLOG 2>&1
  24. exit 1
  25. }
  26. cmd ()
  27. {
  28. echo "Executing: $1\n">$FAILLOG
  29. eval $1 1>>$FAILLOG 2>&1 || die "$2" "$3"
  30. }
  31. cmd "$SHELL ./configure --with-debug" "configure failed"
  32. cmd "make clean" "make clean failed"
  33. cmd "make" "make failed"
  34. cmd "../../src/indexer -c smoke_test.conf --all" "indexing failed"
  35. cmd "../../src/searchd -c smoke_test.conf --test" "searchd start failed"
  36. cmd "sleep 1s"
  37. cmd "./test --smoke --port 10312>$RES" "test --smoke --port 10312 failed"
  38. cmd "../../src/searchd -c smoke_test.conf --stop" "searchd stop failed"
  39. cmd "make clean" " "
  40. cmd "diff --unified=3 $REF $RES >$DIFF" 'diff failed' "cat $DIFF"
  41. rm $RES
  42. rm $DIFF
  43. rm $FAILLOG
  44. echo "all ok"
  45. exit 0