Bläddra i källkod

Merge pull request #10032 from ghalliday/issue17669

HPCC-17669 Allow wutool -selftest to be run on a pre-existing dali

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 år sedan
förälder
incheckning
57a2ab65e5
2 ändrade filer med 5 tillägg och 5 borttagningar
  1. 1 0
      testing/unittests/unittests.hpp
  2. 4 5
      tools/wutool/wutool.cpp

+ 1 - 0
testing/unittests/unittests.hpp

@@ -25,6 +25,7 @@
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/extensions/HelperMacros.h>
 
 
 #define ASSERT(a) { if (!(a)) CPPUNIT_ASSERT(a); }
 #define ASSERT(a) { if (!(a)) CPPUNIT_ASSERT(a); }
+#define ASSERT_EQUAL(a, b) { CPPUNIT_ASSERT_EQUAL(a, b); }
 
 
 /*
 /*
  * Helper class to unload libraries at the end
  * Helper class to unload libraries at the end

+ 4 - 5
tools/wutool/wutool.cpp

@@ -485,6 +485,7 @@ class WuTool : public CppUnit::TestFixture
     CPPUNIT_TEST_SUITE(WuTool);
     CPPUNIT_TEST_SUITE(WuTool);
         CPPUNIT_TEST(testInit);
         CPPUNIT_TEST(testInit);
         CPPUNIT_TEST(testCreate);
         CPPUNIT_TEST(testCreate);
+        CPPUNIT_TEST(testGlobal);
         CPPUNIT_TEST(testValidate);
         CPPUNIT_TEST(testValidate);
         CPPUNIT_TEST(testList);
         CPPUNIT_TEST(testList);
         CPPUNIT_TEST(testList2);
         CPPUNIT_TEST(testList2);
@@ -501,7 +502,6 @@ class WuTool : public CppUnit::TestFixture
         CPPUNIT_TEST(testQuery);
         CPPUNIT_TEST(testQuery);
         CPPUNIT_TEST(testGraph);
         CPPUNIT_TEST(testGraph);
         CPPUNIT_TEST(testGraphProgress);
         CPPUNIT_TEST(testGraphProgress);
-        CPPUNIT_TEST(testGlobal);
     CPPUNIT_TEST_SUITE_END();
     CPPUNIT_TEST_SUITE_END();
 protected:
 protected:
     static StringArray wuids;
     static StringArray wuids;
@@ -1472,8 +1472,7 @@ protected:
             numIterated++;
             numIterated++;
         }
         }
         DBGLOG("%d ranged workunits listed the hard way in %d ms", numIterated, msTick()-start);
         DBGLOG("%d ranged workunits listed the hard way in %d ms", numIterated, msTick()-start);
-        ASSERT(numIterated == testSize);
-
+        ASSERT_EQUAL(before-1, numIterated); // iterate all except the global workunit
 
 
         // Check ascending wuids
         // Check ascending wuids
         WUSortField filterByCluster[] = { WUSFcluster, WUSFterm };
         WUSortField filterByCluster[] = { WUSFcluster, WUSFterm };
@@ -1539,7 +1538,7 @@ protected:
             numIterated++;
             numIterated++;
         }
         }
         DBGLOG("%d workunits ascending thortime in %d ms", numIterated, msTick()-start);
         DBGLOG("%d workunits ascending thortime in %d ms", numIterated, msTick()-start);
-        ASSERT(numIterated == before);
+        ASSERT_EQUAL(before, numIterated);
 
 
         // Test use of cache/page mechanism - on something needing a postsort
         // Test use of cache/page mechanism - on something needing a postsort
         start = msTick();
         start = msTick();
@@ -1641,7 +1640,7 @@ protected:
             startRow++;
             startRow++;
         }
         }
         DBGLOG("%d workunits descending thortime, page by page in %d ms", numIterated, msTick()-start);
         DBGLOG("%d workunits descending thortime, page by page in %d ms", numIterated, msTick()-start);
-        ASSERT(numIterated == before);
+        ASSERT_EQUAL(before, numIterated);
     }
     }
 
 
     void testListByAppValue()
     void testListByAppValue()