]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Revert "Merge catch2_tests into unittest’s main"
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 16 May 2020 14:06:28 +0000 (16:06 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 20 May 2020 18:07:12 +0000 (20:07 +0200)
This reverts commit 4608eb6d6c41aefb7c5f534166901e051e126115.

Since unittest/main.cpp includes src/Util.hpp it’s still too painful to
compile the Catch2 runner, so let’s keep it separate.

Makefile.in
dev.mk.in
unittest/catch2_tests.cpp [new file with mode: 0644]
unittest/catch2_tests.hpp [new file with mode: 0644]
unittest/main.cpp

index 25ccdd4c02e0ac12064e7ee971cfb52d67d3c806..7fe4ed6198f1f0f51a085af841a47521138d4ff2 100644 (file)
@@ -100,6 +100,7 @@ test_suites += unittest/test_hashutil.cpp
 test_suites += unittest/test_legacy_util.cpp
 
 test_sources += unittest/TestUtil.cpp
+test_sources += unittest/catch2_tests.cpp
 test_sources += unittest/main.cpp
 test_sources += $(test_suites)
 test_objs = $(test_sources:.cpp=.o)
index 6c67cca0068ab1458a0e8a89054338a4eea34109..2ad6eb43f1dfcae1950660d81cfa5fc2ddae1f8c 100644 (file)
--- a/dev.mk.in
+++ b/dev.mk.in
@@ -98,7 +98,9 @@ source_dist_files = \
     src/main.cpp \
     src/third_party/minitrace.c \
     test/run \
-    test/suites/*.bash
+    test/suites/*.bash \
+    unittest/catch2_tests.cpp \
+    unittest/catch2_tests.hpp
 
 dist_files = \
     $(addprefix $(srcdir)/, $(source_dist_files)) \
diff --git a/unittest/catch2_tests.cpp b/unittest/catch2_tests.cpp
new file mode 100644 (file)
index 0000000..e6743ed
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2019 Joel Rosdahl and other contributors
+//
+// See doc/AUTHORS.adoc for a complete list of contributors.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along with
+// this program; if not, write to the Free Software Foundation, Inc., 51
+// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+#include "catch2_tests.hpp"
+
+#define CATCH_CONFIG_RUNNER
+#include "third_party/catch.hpp"
+
+int
+run_catch2_tests(int argc, char** argv)
+{
+  return Catch::Session().run(argc, argv);
+}
diff --git a/unittest/catch2_tests.hpp b/unittest/catch2_tests.hpp
new file mode 100644 (file)
index 0000000..f86b15e
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (C) 2019 Joel Rosdahl and other contributors
+//
+// See doc/AUTHORS.adoc for a complete list of contributors.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along with
+// this program; if not, write to the Free Software Foundation, Inc., 51
+// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+#pragma once
+
+int run_catch2_tests(int argc, char** argv);
index 461cf607e129b9307ab5a2c3b751130b245c09c1..3c36e43256ee9fa94fc0ab069ca2aecdc5606fdd 100644 (file)
 
 #include "../src/Util.hpp"
 #include "TestUtil.hpp"
+#include "catch2_tests.hpp"
 
-#include "third_party/fmt/core.h"
-
-#define CATCH_CONFIG_RUNNER
 #include "third_party/catch.hpp"
+#include "third_party/fmt/core.h"
 
 int
 main(int argc, char** argv)
@@ -38,7 +37,7 @@ main(int argc, char** argv)
   Util::create_dir(testdir);
   TestUtil::check_chdir(testdir);
 
-  int result = Catch::Session().run(argc, argv);
+  int result = run_catch2_tests(argc, argv);
 
   if (result == 0) {
     TestUtil::check_chdir(dir_before);