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