Merge pull request #143 from nickbroon/out_src_build_in_travis

Out of source tree build
master
Lothar Braun 2020-05-27 20:27:39 +02:00 committed by GitHub
commit afc3666a7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 9 deletions

View File

@ -225,4 +225,4 @@ matrix:
before_install:
- eval "${MATRIX_EVAL}"
script: cmake -DCMAKE_INSTALL_PREFIX=/tmp -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DSUPPORT_MYSQL="$MYSQL" -DSUPPORT_POSTGRESQL=ON -DSUPPORT_JOURNALD=ON -DSUPPORT_DTLS="$DTLS" -DSUPPORT_ZMQ="$ZMQ" . && make -k && make test && make install
script: mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/tmp -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DSUPPORT_MYSQL="$MYSQL" -DSUPPORT_POSTGRESQL=ON -DSUPPORT_JOURNALD=ON -DSUPPORT_DTLS="$DTLS" -DSUPPORT_ZMQ="$ZMQ" .. && make -k && make test && make install

View File

@ -62,5 +62,5 @@ IF (JOURNALD_FOUND)
ENDIF (JOURNALD_FOUND)
ADD_TEST(vermonttest_build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target vermonttest --config $<CONFIG>)
ADD_TEST(vermont vermonttest)
ADD_TEST(vermont vermonttest -c "${CMAKE_CURRENT_SOURCE_DIR}/test_configs/")
SET_TESTS_PROPERTIES(vermont PROPERTIES DEPENDS vermonttest_build)

View File

@ -7,11 +7,12 @@
#include <map>
#include "modules/ipfix/aggregator/Rules.hpp"
ConfigTester::ConfigTester()
ConfigTester::ConfigTester(std::string config_dir)
: config_dir{config_dir}
{
DIR* dir = opendir("test_configs/");
DIR* dir = opendir(config_dir.c_str());
if (!dir) {
ERROR("Could not open config dir");
ERROR("Could not open config dir %s", config_dir.c_str());
}
struct dirent* d;
@ -43,7 +44,7 @@ Test::TestResult ConfigTester::execTest()
void ConfigTester::testConfig(const std::string& configFile)
{
std::string vermontCommand = "../../../vermont -ddddd -f test_configs/" + configFile;
std::string vermontCommand = "../../../vermont -ddddd -f " + config_dir + "/" + configFile;
std::string generatedOutput = "gen_output/" + configFile;
std::string expectedOutput = "exp_output/" + configFile;

View File

@ -9,13 +9,14 @@
class ConfigTester : public Test
{
public:
ConfigTester();
ConfigTester(std::string config_dir);
~ConfigTester();
virtual TestResult execTest();
private:
void test_Rules_parseProtoPattern();
void testConfig(const std::string& configFile);
std::string config_dir;
std::vector<std::string> configFiles;
};

View File

@ -1,3 +1,5 @@
#include <getopt.h>
#include "VermontTest.h"
#include "AggregationPerfTest.h"
#include "ReconfTest.h"
@ -15,8 +17,30 @@ int main(int argc, char* argv[])
printf("Vermont Testsuite, testing ...\n");
bool perftest = false;
int opt, option_index;
const char *config_dir = nullptr;
if (argc>1 && strcmp(argv[1], "-perf")==0) perftest = true;
static const struct option long_opts[] = {
{ "config-dir", required_argument, NULL, 'c' },
{ "perf", required_argument, NULL, 'p' },
{ NULL, 0, NULL, 0}
};
while ((opt = getopt_long(argc, argv, "pc:", long_opts,
&option_index)) != EOF) {
switch (opt) {
case 'p':
perftest = true;
break;
case 'c':
config_dir = optarg;
break;
}
}
if (!config_dir) {
ERROR("--config-dir is required");
}
//msg_setlevel(LOG_INFO);
@ -29,7 +53,7 @@ int main(int argc, char* argv[])
testSuite.add(new BloomFilterTestSuite());
testSuite.add(new ConnectionFilterTestSuite());
#endif
testSuite.add(new ConfigTester());
testSuite.add(new ConfigTester(config_dir));
testSuite.run();