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

Detect invalid syntax in cppsuite configs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT10.0.1, 5.0.4, 5.2.0, 5.1.0-rc1, 4.4.11
    • Component/s: None
    • Labels:
      None
    • Story Points:
      3
    • Sprint:
      Storage - Ra 2021-10-18

      Description

      The framework currently does not detect invalid configurations due to syntax errors.

      Reproducing the issue:

      Introduce a syntax error:

      diff --git a/test/cppsuite/configs/base_test_default.txt b/test/cppsuite/configs/base_test_default.txt
      index 986dd1937..0a689b8c2 100644
      --- a/test/cppsuite/configs/base_test_default.txt
      +++ b/test/cppsuite/configs/base_test_default.txt
      @@ -25,7 +25,7 @@ runtime_monitor=
       timestamp_manager=
       (
           enabled=true,
      -    oldest_lag=2,
      +    oldest_lag=2
           op_rate=500ms,
           stable_lag=2 

      Run the test:

      ./run -t base_test -l 2 

      You should see the configuration in the log and especially this bit:

      timestamp_manager=(enabled=true,oldest_lag=1,op_rate=1s,stable_lag=1) 

      The oldest_lag is set to its default value of 1 second instead of the user-defined 2 seconds.

      By adding more traces in the code, especially in the split_config function, I could see the following during the parsing of the configuration:

      enabled=true,oldest_lag=2op_rate=500ms,stable_lag=2 

      Suggested fixes:

      Exit the test by telling the user there is a syntax issue

      diff --git a/test/cppsuite/test_harness/core/configuration.cxx b/test/cppsuite/test_harness/core/configuration.cxx
      index b6c533979..ffb146091 100644
      --- a/test/cppsuite/test_harness/core/configuration.cxx
      +++ b/test/cppsuite/test_harness/core/configuration.cxx
      @@ -258,6 +258,8 @@ configuration::split_config(const std::string &config)
                   in_subconfig = !parens.empty();
               }
               if (cut_config[i] == '=' && !in_subconfig) {
      +            testutil_assert(expect_value == false);
      +            testutil_assert(len > 0);
                   expect_value = true;
                   key = cut_config.substr(start, len);
                   start += len + 1; 

       

      Definition of done:

      Make sure the framework is robust against syntax errors in the configuration files. More changes in the parsing function might be required.

        Attachments

          Activity

            People

            Assignee:
            alison.felizzi Alison Felizzi
            Reporter:
            etienne.petrel Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: