Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5980

QuidemTests are not effectively executed on Windows

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      Discovered by accident on my Windows+IntelliJ environment while I was trying to add new tests on a *.iq file. My new tests did not seem to be executed. I even tried adding syntax errors on purpose into different iq files to force them to fail, but the tests were still successful. The reason seems to be that, at least on my environment (Windows), the test files do not execute any of their statements. This seems caused by the changes introduced in CALCITE-5786.

      While debugging, I found this line in QuidemTest.java (that aims to create the inFile and outFile):

      protected void checkRun(String path) throws Exception {
        ...
        // e.g. path = "sql/agg.iq"
        // inUrl = "file:/home/fred/calcite/core/build/resources/test/sql/agg.iq"
        // inFile = "/home/fred/calcite/core/build/resources/test/sql/agg.iq"
        // outDir = "/home/fred/calcite/core/build/quidem/test/sql"
        // outFile = "/home/fred/calcite/core/build/quidem/test/sql/agg.iq"
        inFile = Sources.of(requireNonNull(inUrl, "inUrl")).file();
        outFile = replaceDir(inFile, "resources", "quidem");
        ...
      }
      

      But in my case it results on both files being the same, thus when the outFile is created, it actually erases all the tests that were contained inside the inFile, so the test runs nothing.

      The reason for that is that the auxiliary method replaceDir:

        private static File replaceDir(File file, String target, String replacement) {
          return new File(
              file.getAbsolutePath().replace(n2u('/' + target + '/'),
                  n2u('/' + replacement + '/')));
        }
      

      is trying to replace "/resources/" with "/quidem/" from the inFile absolute path, but in my case this path does not contain the pattern to be replaced, since it contains backslashes: "C:\...\calcite\core\build\resources\test\sql\agg.iq"; so the replacement operation does nothing.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rubenql Ruben Q L
            rubenql Ruben Q L
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment