featuretest 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. # This script builds and runs INET with the various features turned on and off testing
  3. # whether features can be enabled and disabled independently without causing
  4. # build or runtime failures.
  5. skipped_features="TCP_NSC VoIPStream"
  6. # test procedure that is run for each test case (assumes to be in INET_ROOT)
  7. runtest() {
  8. (make makefiles >/dev/null && make cleanall >/dev/null && make makefiles >/dev/null) || { echo "*** $1 prepare build: FAIL" ; return; }
  9. make -j8 >/$LOG_DIR/$1-build.out 2>/$LOG_DIR/$1-build.err || { echo "*** $1 building: FAIL" ; return; }
  10. (cd $DIR; opp_run -l ../../src/INET -u Cmdenv -n ../../src:. >/$LOG_DIR/$1-run.out 2>/$LOG_DIR/$1-run.err) || { echo "*** $1 running: FAIL" ; return; }
  11. echo "*** $1: PASS"
  12. }
  13. cd `dirname $0`
  14. DIR=`pwd`
  15. LOG_DIR=`pwd`/_log
  16. rm -rf $LOG_DIR; mkdir -p $LOG_DIR
  17. cd ../..
  18. echo "Running feature build and run tests..."
  19. base_features=$(./inet_featuretool list | grep -v _examples | awk '{print $2;}')
  20. if [ -n "$skipped_features" ]; then
  21. echo "Skipping the following features: $skipped_features"
  22. fi
  23. # test with all features disabled
  24. ./inet_featuretool -q disable -f all
  25. runtest all_disabled
  26. # test with default features enabled (except skipped ones)
  27. ./inet_featuretool -q reset
  28. if [ -n "$skipped_features" ]; then
  29. ./inet_featuretool -q disable -f $skipped_features
  30. fi
  31. runtest default
  32. # test with all features enabled (except skipped ones)
  33. ./inet_featuretool -q enable -f all
  34. if [ -n "$skipped_features" ]; then
  35. ./inet_featuretool -q disable -f $skipped_features
  36. fi
  37. runtest all_enabled
  38. # test with each feature enabled - one by one
  39. for feature in $base_features; do
  40. if echo $skipped_features | grep -q $feature; then
  41. echo "*** ${feature}_enabled: SKIPPED"
  42. else
  43. ./inet_featuretool -q disable -f all
  44. ./inet_featuretool -q enable -f $feature
  45. runtest ${feature}_enabled
  46. fi
  47. done
  48. # test with each feature disabled - one by one
  49. for feature in $base_features; do
  50. ./inet_featuretool -q enable -f all
  51. if [ -n "$skipped_features" ]; then
  52. ./inet_featuretool -q disable -f $skipped_features
  53. fi
  54. if echo $skipped_features | grep -q $feature; then
  55. echo "*** ${feature}_disabled: SKIPPED"
  56. else
  57. ./inet_featuretool -q disable -f $feature
  58. runtest ${feature}_disabled
  59. fi
  60. done