diff options
author | Arne H Juul <arnej@yahoo-inc.com> | 2016-06-30 13:28:08 +0200 |
---|---|---|
committer | Arne H Juul <arnej@yahoo-inc.com> | 2016-06-30 15:02:12 +0200 |
commit | 419578bee89068645051556ea591ddeda34aaa85 (patch) | |
tree | 4d3aad651a21c440511479c15142ecb071fb5725 | |
parent | ec03bb7d9f40d4cc4ea5a66bd2553588a6195f0b (diff) |
return 0 only if all ok
-rw-r--r-- | fastos/src/tests/backtracetest.cpp | 2 | ||||
-rw-r--r-- | fastos/src/tests/filetest.cpp | 2 | ||||
-rw-r--r-- | fastos/src/tests/processtest.cpp | 2 | ||||
-rw-r--r-- | fastos/src/tests/tests.h | 19 | ||||
-rw-r--r-- | fastos/src/tests/thread_bounce_test.cpp | 5 | ||||
-rw-r--r-- | fastos/src/tests/thread_joinwait_test.cpp | 3 | ||||
-rw-r--r-- | fastos/src/tests/thread_mutex_test.cpp | 3 | ||||
-rw-r--r-- | fastos/src/tests/thread_sleep_test.cpp | 3 | ||||
-rw-r--r-- | fastos/src/tests/thread_stats_test.cpp | 3 | ||||
-rw-r--r-- | fastos/src/tests/threadtest.cpp | 3 | ||||
-rw-r--r-- | fastos/src/tests/timetest.cpp | 2 | ||||
-rw-r--r-- | fastos/src/tests/typetest.cpp | 2 |
12 files changed, 29 insertions, 20 deletions
diff --git a/fastos/src/tests/backtracetest.cpp b/fastos/src/tests/backtracetest.cpp index 2ad80c18422..31aa602070a 100644 --- a/fastos/src/tests/backtracetest.cpp +++ b/fastos/src/tests/backtracetest.cpp @@ -107,7 +107,7 @@ public: int Main () { TestBackTrace(); - return 0; + return allWasOk() ? 0 : 1; } }; diff --git a/fastos/src/tests/filetest.cpp b/fastos/src/tests/filetest.cpp index 24483076ed0..5b050edcc0b 100644 --- a/fastos/src/tests/filetest.cpp +++ b/fastos/src/tests/filetest.cpp @@ -889,7 +889,7 @@ public: PrintSeparator(); printf("END OF TEST (%s)\n", _argv[0]); - return 0; + return allWasOk() ? 0 : 1; } }; diff --git a/fastos/src/tests/processtest.cpp b/fastos/src/tests/processtest.cpp index bb7377f4d42..0e1573dbe2e 100644 --- a/fastos/src/tests/processtest.cpp +++ b/fastos/src/tests/processtest.cpp @@ -464,7 +464,7 @@ public: printf("END OF TEST (%s)\n", _argv[0]); - return 0; + return allWasOk() ? 0 : 1; } }; diff --git a/fastos/src/tests/tests.h b/fastos/src/tests/tests.h index fdaa719669d..09604829b3c 100644 --- a/fastos/src/tests/tests.h +++ b/fastos/src/tests/tests.h @@ -11,12 +11,14 @@ private: BaseTest &operator=(const BaseTest&); int totallen; + bool _allOkFlag; public: const char *okString; const char *failString; BaseTest () : totallen(70), + _allOkFlag(true), okString("SUCCESS"), failString("FAILURE") { @@ -24,6 +26,8 @@ public: virtual ~BaseTest() {}; + bool allWasOk() const { return _allOkFlag; } + void PrintSeparator () { for(int i=0; i<totallen; i++) printf("-"); @@ -32,7 +36,7 @@ public: virtual void PrintProgress (char *string) { - printf(string); + printf("%s", string); } #define MAX_STR_LEN 3000 bool Progress (bool result, const char *str) @@ -41,6 +45,7 @@ public: sprintf(string, "%s: %s\n", result ? okString : failString, str); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -51,6 +56,7 @@ public: sprintf(&string[strlen(string)], str, d1); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -61,6 +67,7 @@ public: sprintf(&string[strlen(string)], str, d1, d2); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -71,6 +78,7 @@ public: sprintf(&string[strlen(string)], str, s1); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -81,6 +89,7 @@ public: sprintf(&string[strlen(string)], str, s1); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -91,6 +100,7 @@ public: sprintf(&string[strlen(string)], str, s1); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -101,6 +111,7 @@ public: sprintf(&string[strlen(string)], str, s1, s2); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -111,6 +122,7 @@ public: sprintf(&string[strlen(string)], str, s1, d1); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -121,6 +133,7 @@ public: sprintf(&string[strlen(string)], str, d1, s1); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -131,6 +144,7 @@ public: sprintf(&string[strlen(string)], str, val); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -141,6 +155,7 @@ public: sprintf(&string[strlen(string)], str, val); sprintf(&string[strlen(string)], "\n"); PrintProgress(string); + if (! result) { _allOkFlag = false; } return result; } @@ -165,7 +180,7 @@ public: for(i=0; i<totallen; i++) printf("*"); printf("\n**"); for(i=0; i<leftspace; i++) printf(" "); //forgot printf-specifier.. - printf(string); + printf("%s", string); for(i=0; i<rightspace; i++) printf(" "); printf("**\n"); for(i=0; i<totallen; i++) printf("*"); diff --git a/fastos/src/tests/thread_bounce_test.cpp b/fastos/src/tests/thread_bounce_test.cpp index 5a34193926c..69ca81e3708 100644 --- a/fastos/src/tests/thread_bounce_test.cpp +++ b/fastos/src/tests/thread_bounce_test.cpp @@ -81,11 +81,10 @@ int Thread_Bounce_Test::Main () time_t before = time(0); BounceTest(); - { time_t now = time(0); printf("[%ld seconds]\n", now-before); before = now; } + { time_t now = time(0); printf("[%ld seconds]\n", now-before); before = now; } printf("END OF TEST (%s)\n", _argv[0]); - - return 0; + return allWasOk() ? 0 : 1; } int main (int argc, char **argv) diff --git a/fastos/src/tests/thread_joinwait_test.cpp b/fastos/src/tests/thread_joinwait_test.cpp index 758eb204b9f..38cc249e803 100644 --- a/fastos/src/tests/thread_joinwait_test.cpp +++ b/fastos/src/tests/thread_joinwait_test.cpp @@ -111,8 +111,7 @@ int Thread_JoinWait_Test::Main () { time_t now = time(0); printf("[%ld seconds]\n", now-before); before = now; } printf("END OF TEST (%s)\n", _argv[0]); - - return 0; + return allWasOk() ? 0 : 1; } int main (int argc, char **argv) diff --git a/fastos/src/tests/thread_mutex_test.cpp b/fastos/src/tests/thread_mutex_test.cpp index 801dd8dfa11..417558ea74d 100644 --- a/fastos/src/tests/thread_mutex_test.cpp +++ b/fastos/src/tests/thread_mutex_test.cpp @@ -184,8 +184,7 @@ int Thread_Mutex_Test::Main () { time_t now = time(0); printf("[%ld seconds]\n", now-before); before = now; } printf("END OF TEST (%s)\n", _argv[0]); - - return 0; + return allWasOk() ? 0 : 1; } int main (int argc, char **argv) diff --git a/fastos/src/tests/thread_sleep_test.cpp b/fastos/src/tests/thread_sleep_test.cpp index 4e84d9fef80..87b2c040b3a 100644 --- a/fastos/src/tests/thread_sleep_test.cpp +++ b/fastos/src/tests/thread_sleep_test.cpp @@ -43,8 +43,7 @@ int Thread_Sleep_Test::Main () { time_t now = time(0); printf("[%ld seconds]\n", now-before); before = now; } printf("END OF TEST (%s)\n", _argv[0]); - - return 0; + return allWasOk() ? 0 : 1; } int main (int argc, char **argv) diff --git a/fastos/src/tests/thread_stats_test.cpp b/fastos/src/tests/thread_stats_test.cpp index 9959406cc8c..2f1a9b0d51a 100644 --- a/fastos/src/tests/thread_stats_test.cpp +++ b/fastos/src/tests/thread_stats_test.cpp @@ -127,8 +127,7 @@ int Thread_Stats_Test::Main () { time_t now = time(0); printf("[%ld seconds]\n", now-before); before = now; } printf("END OF TEST (%s)\n", _argv[0]); - - return 0; + return allWasOk() ? 0 : 1; } int main (int argc, char **argv) diff --git a/fastos/src/tests/threadtest.cpp b/fastos/src/tests/threadtest.cpp index 6d4a6b03b8f..f1e56f4fe77 100644 --- a/fastos/src/tests/threadtest.cpp +++ b/fastos/src/tests/threadtest.cpp @@ -592,8 +592,7 @@ int ThreadTest::Main () { time_t now = time(0); printf("[%ld seconds]\n", now-before); before = now; } printf("END OF TEST (%s)\n", _argv[0]); - - return 0; + return allWasOk() ? 0 : 1; } int main (int argc, char **argv) diff --git a/fastos/src/tests/timetest.cpp b/fastos/src/tests/timetest.cpp index a8db91ed0c8..b63ebf7fa02 100644 --- a/fastos/src/tests/timetest.cpp +++ b/fastos/src/tests/timetest.cpp @@ -283,7 +283,7 @@ int TimeTest::Main () printf("END OF TEST (%s)\n", _argv[0]); - return 0; + return allWasOk() ? 0 : 1; } diff --git a/fastos/src/tests/typetest.cpp b/fastos/src/tests/typetest.cpp index 5439c1ad071..6db029a41f1 100644 --- a/fastos/src/tests/typetest.cpp +++ b/fastos/src/tests/typetest.cpp @@ -78,7 +78,7 @@ public: PrintSeparator(); printf("END OF TEST (%s)\n", _argv[0]); - return 0; + return allWasOk() ? 0 : 1; } }; |