build: Use global variables instead of macros for test features
We don't want the build to depend on recompiling objects for test
separately from other executables. We can tweak settings via global
variables instead.
Change-Id: Ifdd078c2e381848ca1789934a36731eb8ceaf8b1
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/common.cpp b/test/common.cpp
new file mode 100644
index 0000000..8905793
--- /dev/null
+++ b/test/common.cpp
@@ -0,0 +1,5 @@
+#include "config.h"
+
+const char* ERRLOG_PERSIST_PATH = "/tmp/errors";
+const char* EXTENSION_PERSIST_DIR = "/tmp/extensions";
+const bool IS_UNIT_TEST = true;
diff --git a/test/meson.build b/test/meson.build
index 1538b7f..6bd81ac 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -41,13 +41,10 @@
executable(
'test-' + t.underscorify(),
t + '.cpp',
+ 'common.cpp',
log_manager_sources,
'../phosphor-rsyslog-config/server-conf.cpp',
link_with: libphosphor_logging,
- cpp_args: [
- '-DTESTCASE=' + t.underscorify(),
- '-DTESTCASE_' + t.underscorify(),
- ],
dependencies: [
gmock_dep,
gtest_dep,
diff --git a/test/openpower-pels/meson.build b/test/openpower-pels/meson.build
index 3527bed..0c7567e 100644
--- a/test/openpower-pels/meson.build
+++ b/test/openpower-pels/meson.build
@@ -63,10 +63,8 @@
'paths.cpp',
libpel_sources,
peltool_sources,
+ '../common.cpp',
'../../util.cpp',
- cpp_args: [
- '-DTESTCASE=openpower_test_lib',
- ],
include_directories: include_directories(
'../../',
'../../gen',
@@ -89,10 +87,6 @@
libphosphor_logging,
],
link_args: [ '-lpython' + python_ver ],
- cpp_args: [
- '-DTESTCASE=' + t.underscorify(),
- '-DTESTCASE_' + t.underscorify(),
- ],
dependencies: [
gtest_dep,
gmock_dep,