Skip to content
Snippets Groups Projects
Commit f5731ed8 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

Leave test directory unchanged when running make check

parent 3e1e9421
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@
#include <stdio.h>
#include <sstream>
#include <cstdlib>
#include "historytest.h"
#include "manager.h"
......@@ -41,6 +42,7 @@ using std::endl;
void HistoryTest::setUp()
{
system("cp " HISTORY_SAMPLE " " HISTORY_SAMPLE ".bak");
// Instanciate the cleaner singleton
history = new HistoryManager();
}
......@@ -51,11 +53,7 @@ void HistoryTest::test_create_history_path()
_debug ("-------------------- HistoryTest::test_create_history_path --------------------\n");
int result;
char *cpath;
std::string path;
cpath = getenv ("XDG_DATA_HOME");
(cpath != NULL) ? path = std::string (cpath) : path = std::string ("/") + HISTORY_SAMPLE;
std::string path(HISTORY_SAMPLE);
result = history->create_history_path(path);
CPPUNIT_ASSERT (result == 0);
......@@ -228,4 +226,5 @@ void HistoryTest::tearDown()
// Delete the history object
delete history;
history = 0;
system("mv " HISTORY_SAMPLE ".bak " HISTORY_SAMPLE);
}
......@@ -32,6 +32,8 @@
#include <manager.h>
#include <constants.h>
#include <cstdlib>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/XmlOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
......@@ -39,7 +41,6 @@
int main (int argc, char* argv[])
{
printf ("\nSFLphone Daemon Test Suite, by Savoir-Faire Linux 2004-2010\n\n");
Logger::setConsoleLog (true);
Logger::setDebugMode (true);
......@@ -65,7 +66,7 @@ int main (int argc, char* argv[])
printf (" - %s\n", suite->getChildTestAt (i)->getName().c_str());
}
exit (0);
return 0;
} else if (strcmp ("--debug", argv[1]) == 0) {
argvIndex++;
......@@ -89,6 +90,7 @@ int main (int argc, char* argv[])
}
printf ("\n\n=== SFLphone initialization ===\n\n");
system("cp " CONFIG_SAMPLE " " CONFIG_SAMPLE ".bak");
Manager::instance().initConfigFile (true, CONFIG_SAMPLE);
Manager::instance().init();
......@@ -98,7 +100,8 @@ int main (int argc, char* argv[])
if (suite->getChildTestCount() == 0) {
_error ("Invalid test suite name: %s", testSuiteName.c_str());
exit (-1);
system("mv " CONFIG_SAMPLE ".bak " CONFIG_SAMPLE);
return 1;
}
// Adds the test to the list of test to run
......@@ -120,6 +123,7 @@ int main (int argc, char* argv[])
Manager::instance().terminate();
// Return error code 1 if the one of test failed.
system("mv " CONFIG_SAMPLE ".bak " CONFIG_SAMPLE);
return wasSucessful ? 0 : 1;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment