Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

runtest_context.sh 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/bash
  2. #
  3. # Usage : ./runtest [OPTIONS] [test_module[.test_class][ test_module2[.test_class2]...]
  4. #########
  5. #
  6. # Options list :
  7. ################
  8. #
  9. # -b, --buffer
  10. #
  11. # The standard output and standard error streams are buffered during the test run. Output during a passing test is discarded. Output is echoed normally on test fail or error and is added to the failure messages.
  12. #
  13. # -c, --catch
  14. #
  15. # Control-C during the test run waits for the current test to end and then reports all the results so far. A second control-C raises the normal KeyboardInterrupt exception.
  16. #
  17. #
  18. # -f, --failfast
  19. #
  20. # Stop the test run on the first error or failure.
  21. #
  22. # -h, --help
  23. #
  24. # Get some help
  25. #
  26. # -v, --verbose
  27. #
  28. # higher verbosity
  29. #
  30. # Examples :
  31. ############
  32. #
  33. # Running all discoverables tests :
  34. # ./runtest
  35. #
  36. # Running only Em test about component object (only tests about the __init__ and modify_rank methods) with higher verbosity and failfast :
  37. # ./runtest -fv EditorialModel.test.test_component.TestInit EditorialModel.test.test_component.TestModifyRank
  38. #
  39. #
  40. # Running only Em tests
  41. # ./runtest discover EditorialModel
  42. #
  43. # More details :
  44. ################
  45. #
  46. # https://docs.python.org/3.4/library/unittest.html
  47. #
  48. if test ! -f lodel/buildconf.py
  49. then
  50. echo "You have to build the project before running the tests"
  51. echo "See README"
  52. exit 1
  53. fi
  54. PYTHON='env python3'
  55. testdir=$(mktemp -td "lodel2_unittest_instance_XXXXXXXX")
  56. install_model_dir="[@]INSTALLMODEL_DIR[@]"
  57. if [ ! -d "$install_model_dir" ]
  58. then
  59. install_model_dir="$(dirname $0)/progs/slim/install_model/"
  60. fi
  61. libdir="$(dirname $(realpath $0))/lodel"
  62. rmdir $testdir
  63. progs/create_instance test_instance $testdir "$install_model_dir" examples/em_test.pickle "$libdir"
  64. echo progs/create_instance test_instance $testdir "$install_model_dir" examples/em_test.pickle "$libdir"
  65. cp -R examples $testdir
  66. cp -R tests $testdir
  67. cd $testdir
  68. chmod +x lodel_admin.py
  69. rm -R conf.d && mv tests/tests_conf.d conf.d
  70. make
  71. make refresh_plugins
  72. $PYTHON loader.py $@ && ret_status=0 || ret_status=1
  73. rm -Rf $testdir
  74. exit $ret_status