Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-8007

Update script to correctly generate new test for the CPP test suite framework

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 5.0.4, 4.4.10, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • 2
    • Storage - Ra 2021-09-06

      The file create_test.sh can be used to generate a new test in the CPP framework. Some changes made in WT-7539 broke the correct generation of a new test.

      To reproduce:

      # Generate the test
      ./create_test.sh some_test
      # Compile
      ...
      # Execute the test
      ./run -t some_test
      [2021-08-27T06:33:06.976717682Z][TID:140489733315328][ERROR]: Test not found: some_test
      [2021-08-27T06:33:06.976762163Z][TID:140489733315328][ERROR]: Test some_test failed.

      The traces show that the test was not found. Indeed, we miss the generation of those two lines in run.cxx:

          else if (test_name == "some_test")
              some_test(test_harness::test_args{config, test_name, wt_open_config}).run(); 

      Suggested fix (we need to update the source code that is being looked up):

      diff --git a/test/cppsuite/create_test.sh b/test/cppsuite/create_test.sh
      index 5076b43c7..01cdefc64 100755
      --- a/test/cppsuite/create_test.sh
      +++ b/test/cppsuite/create_test.sh
      @@ -52,9 +52,9 @@ VALUE="#include \"$1.cxx\""
       sed -i "/$SEARCH/a $VALUE" $FILE
       
       # Add the new test to the run_test() method
      -SEARCH="example_test(config, test_name).run()"
      -LINE_1="\    else if (test_name == \"$1\")\n"
      -LINE_2="\        $1(config, test_name).run();"
      +SEARCH="example_test(test_harness::test_args{config, test_name, wt_open_config}).run()"
      +LINE_1="\else if (test_name == \"$1\")\n"
      +LINE_2="\\$1(test_harness::test_args{config, test_name, wt_open_config}).run();"
       sed -i "/$SEARCH/a $LINE_1$LINE_2" $FILE 

      Definition of done:

      The new test runs successfully when executed after being created using the script.

       # Generate the test
      ./create_test.sh some_test
      # Compile
      ...
      # Execute the test
      ./run -t some_test
      populate: nothing done.

            Assignee:
            etienne.petrel@mongodb.com Etienne Petrel
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: