File: 0002-Enable-tests-for-Debian.patch

package info (click to toggle)
cctz 2.3%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 648 kB
  • sloc: cpp: 7,661; makefile: 62; ansic: 17; sh: 16
file content (102 lines) | stat: -rw-r--r-- 3,535 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From: Anton Gladky <gladk@debian.org>
Date: Wed, 15 Nov 2017 19:45:46 +0100
Subject: [PATCH 2/2] Enable tests for Debian

---
 CMakeLists.txt | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

Index: cctz/CMakeLists.txt
===================================================================
--- cctz.orig/CMakeLists.txt
+++ cctz/CMakeLists.txt
@@ -21,19 +21,15 @@ if (BUILD_TESTING)
     URL "https://github.com/google/benchmark"
   )
 
-  find_package(GMock)
-  set_package_properties(GMock PROPERTIES
-    TYPE REQUIRED
-    DESCRIPTION "the Google C++ mocking framework"
-    URL "https://github.com/google/googletest"
-  )
 
-  find_package(GTest)
-  set_package_properties(GTest PROPERTIES
-    TYPE REQUIRED
-    DESCRIPTION "the Google C++ test framework"
-    URL "https://github.com/google/googletest"
-  )
+  SET (GOOGLETESTSRC
+                 /usr/src/googletest/googletest/src/gtest_main.cc
+                 /usr/src/googletest/googletest/src/gtest-all.cc
+                 )
+  include_directories("/usr/src/googletest/googlemock")
+  include_directories("/usr/src/googletest/googlemock/include")
+  include_directories("/usr/src/googletest/googletest")
+  include_directories("/usr/src/googletest/googletest/include")
 
   find_package(Threads)
   set_package_properties(Threads PROPERTIES
@@ -118,7 +114,7 @@ if (BUILD_EXAMPLES)
 endif()
 
 if (BUILD_TESTING)
-  add_executable(civil_time_test src/civil_time_test.cc)
+  add_executable(civil_time_test src/civil_time_test.cc ${GOOGLETESTSRC})
   cctz_target_set_cxx_standard(civil_time_test)
   target_include_directories(civil_time_test PRIVATE ${GTEST_INCLUDE_DIRS})
   target_link_libraries(civil_time_test
@@ -128,7 +124,9 @@ if (BUILD_TESTING)
     )
   add_test(civil_time_test civil_time_test)
 
-  add_executable(time_zone_lookup_test src/time_zone_lookup_test.cc)
+  add_executable(time_zone_lookup_test src/time_zone_lookup_test.cc
+                 ${GOOGLETESTSRC}
+                 )
   cctz_target_set_cxx_standard(time_zone_lookup_test)
   target_include_directories(time_zone_lookup_test PRIVATE ${GTEST_INCLUDE_DIRS})
   target_link_libraries(time_zone_lookup_test
@@ -138,12 +136,14 @@ if (BUILD_TESTING)
     )
   add_test(time_zone_lookup_test time_zone_lookup_test)
 
-  add_executable(time_zone_format_test src/time_zone_format_test.cc)
+  add_executable(time_zone_format_test src/time_zone_format_test.cc
+                 ${GOOGLETESTSRC}
+                 )
+
   cctz_target_set_cxx_standard(time_zone_format_test)
   target_link_libraries(time_zone_format_test
     cctz::cctz
     ${CMAKE_THREAD_LIBS_INIT}
-    GMock::Main
     )
   add_test(time_zone_format_test time_zone_format_test)
 
@@ -160,6 +160,10 @@ if (BUILD_TESTING)
   add_executable(cctz_benchmark src/cctz_benchmark.cc)
   cctz_target_set_cxx_standard(cctz_benchmark)
   target_link_libraries(cctz_benchmark cctz::cctz benchmark::benchmark_main)
+  EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
+  if ( NOT ${ARCHITECTURE} MATCHES "mips")
+    add_test(cctz_benchmark cctz_benchmark)
+  endif ( NOT ${ARCHITECTURE} MATCHES "mips")
 endif()
 
 # Install
Index: cctz/src/cctz_benchmark.cc
===================================================================
--- cctz.orig/src/cctz_benchmark.cc
+++ cctz/src/cctz_benchmark.cc
@@ -25,6 +25,9 @@
 #include "cctz/time_zone.h"
 #include "time_zone_impl.h"
 
+// Run the benchmark
+BENCHMARK_MAIN();
+
 namespace {
 
 void BM_Difference_Days(benchmark::State& state) {