You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2019/11/21 05:24:43 UTC
[trafficserver] branch master updated: Fixed next hop tests for out
of tree builds
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
View the commit online:
https://github.com/apache/trafficserver/commit/e541bc744a3ccd06648776f699f5f70976d8dcdf
The following commit(s) were added to refs/heads/master by this push:
new e541bc7 Fixed next hop tests for out of tree builds
e541bc7 is described below
commit e541bc744a3ccd06648776f699f5f70976d8dcdf
Author: Bryan Call <bc...@apache.org>
AuthorDate: Thu Nov 21 11:37:46 2019 +0800
Fixed next hop tests for out of tree builds
---
proxy/http/remap/Makefile.am | 3 +++
proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc | 6 +++---
proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc | 8 ++++----
proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc | 11 +++++++----
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/proxy/http/remap/Makefile.am b/proxy/http/remap/Makefile.am
index 89be4da..c569801 100644
--- a/proxy/http/remap/Makefile.am
+++ b/proxy/http/remap/Makefile.am
@@ -125,6 +125,7 @@ test_RemapPluginInfo_SOURCES = \
test_NextHopStrategyFactory_CPPFLAGS = \
$(AM_CPPFLAGS) \
-D_NH_UNIT_TESTS_ \
+ -DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
-I$(abs_top_srcdir)/tests/include \
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@
@@ -154,6 +155,7 @@ test_NextHopStrategyFactory_SOURCES = \
test_NextHopRoundRobin_CPPFLAGS = \
$(AM_CPPFLAGS) \
-D_NH_UNIT_TESTS_ \
+ -DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
-I$(abs_top_srcdir)/tests/include \
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@
@@ -183,6 +185,7 @@ test_NextHopRoundRobin_SOURCES = \
test_NextHopConsistentHash_CPPFLAGS = \
$(AM_CPPFLAGS) \
-D_NH_UNIT_TESTS_ \
+ -DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
-I$(abs_top_srcdir)/tests/include \
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@
diff --git a/proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc b/proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc
index 912a5da..cbd29bd 100644
--- a/proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc
+++ b/proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc
@@ -51,7 +51,7 @@ SCENARIO("Testing NextHopConsistentHash class, using policy 'consistent_hash'",
{
// load the configuration strtegies.
std::shared_ptr<NextHopSelectionStrategy> strategy;
- NextHopStrategyFactory nhf("unit-tests/consistent-hash-tests.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml");
strategy = nhf.strategyInstance("consistent-hash-1");
WHEN("the config is loaded.")
@@ -190,7 +190,7 @@ SCENARIO("Testing NextHopConsistentHash class (all firstcalls), using policy 'co
GIVEN("Loading the consistent-hash-tests.yaml config for 'consistent_hash' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
- NextHopStrategyFactory nhf("unit-tests/consistent-hash-tests.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml");
strategy = nhf.strategyInstance("consistent-hash-1");
WHEN("the config is loaded.")
@@ -292,7 +292,7 @@ SCENARIO("Testing NextHopConsistentHash class (alternating rings), using policy
GIVEN("Loading the consistent-hash-tests.yaml config for 'consistent_hash' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
- NextHopStrategyFactory nhf("unit-tests/consistent-hash-tests.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml");
strategy = nhf.strategyInstance("consistent-hash-2");
WHEN("the config is loaded.")
diff --git a/proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc b/proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc
index 7df2fd3..df47f3c 100644
--- a/proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc
+++ b/proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc
@@ -41,7 +41,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'rr-strict'", "[NextHopR
GIVEN("Loading the round-robin-tests.yaml config for round robin 'rr-strict' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
- NextHopStrategyFactory nhf("unit-tests/round-robin-tests.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml");
strategy = nhf.strategyInstance("rr-strict-exhaust-ring");
WHEN("the config is loaded.")
@@ -146,7 +146,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'first-live'", "[NextHop
GIVEN("Loading the round-robin-tests.yaml config for round robin 'first-live' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
- NextHopStrategyFactory nhf("unit-tests/round-robin-tests.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml");
strategy = nhf.strategyInstance("first-live");
WHEN("the config is loaded.")
@@ -205,7 +205,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'rr-ip'", "[NextHopRound
GIVEN("Loading the round-robin-tests.yaml config for round robin 'rr-ip' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
- NextHopStrategyFactory nhf("unit-tests/round-robin-tests.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml");
strategy = nhf.strategyInstance("rr-ip");
sockaddr_in sa1, sa2;
sa1.sin_port = 10000;
@@ -266,7 +266,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'latched'", "[NextHopRou
GIVEN("Loading the round-robin-tests.yaml config for round robin 'latched' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
- NextHopStrategyFactory nhf("unit-tests/round-robin-tests.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml");
strategy = nhf.strategyInstance("latched");
WHEN("the config is loaded.")
diff --git a/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc b/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc
index 2bfc260..de9a71f 100644
--- a/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc
+++ b/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc
@@ -43,7 +43,10 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]")
{
GIVEN("Loading the strategy.yaml with included 'hosts.yaml'.")
{
- NextHopStrategyFactory nhf("unit-tests/strategy.yaml");
+#ifdef TS_SRC_DIR
+ REQUIRE(chdir(TS_SRC_DIR) == 0);
+#endif
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/strategy.yaml");
WHEN("the two files are loaded.")
{
@@ -216,7 +219,7 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]")
GIVEN("loading a yaml config, simple-strategy.yaml ")
{
- NextHopStrategyFactory nhf("unit-tests/simple-strategy.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/simple-strategy.yaml");
WHEN("loading the single file")
{
@@ -357,7 +360,7 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]")
GIVEN("loading a yaml config combining hosts and strategies into one file, combined.yaml")
{
- NextHopStrategyFactory nhf("unit-tests/combined.yaml");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/combined.yaml");
WHEN("loading the single file")
{
@@ -779,7 +782,7 @@ SCENARIO("factory tests loading yaml configs from a directory", "[loadConfig]")
{
GIVEN("Loading the strategies using a directory of 'yaml' files")
{
- NextHopStrategyFactory nhf("unit-tests/strategies-dir");
+ NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/strategies-dir");
WHEN("the two files are loaded.")
{