summaryrefslogtreecommitdiffstats
path: root/fastos/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'fastos/src/tests')
-rw-r--r--fastos/src/tests/coretest.cpp68
-rw-r--r--fastos/src/tests/tests.h17
-rw-r--r--fastos/src/tests/typetest.cpp1
3 files changed, 15 insertions, 71 deletions
diff --git a/fastos/src/tests/coretest.cpp b/fastos/src/tests/coretest.cpp
deleted file mode 100644
index 01742791c58..00000000000
--- a/fastos/src/tests/coretest.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-
-
-
-static void
-bomb(void)
-{
- char *p;
-
- p = nullptr;
- *p = 4;
-}
-
-class FastS_Bomber : public FastOS_Runnable
-{
- void Run(FastOS_ThreadInterface *thread, void *arg)
- {
- (void) thread;
- (void) arg;
- bomb();
- }
-};
-
-static int
-bombMain(void)
-{
- FastOS_ThreadPool *pool = new FastOS_ThreadPool(128*1024);
- FastS_Bomber bomber;
- FastOS_ThreadInterface *thread;
-
- thread = pool->NewThread(&bomber, nullptr);
- if (thread != nullptr)
- thread->Join();
-
- pool->Close();
- delete pool;
- return (0);
-}
-
-
-class FastS_CoreTestApp : public FastOS_Application
-{
-public:
- FastS_CoreTestApp(void) { }
- ~FastS_CoreTestApp(void) { }
- int Main(void);
-};
-
-
-int
-FastS_CoreTestApp::Main(void)
-{
-
- return bombMain();
-}
-
-
-int
-main(int argc, char **argv)
-{
- FastS_CoreTestApp app;
- setvbuf(stdout, nullptr, _IOLBF, 8192);
- if (argc == 1)
- return app.Entry(argc, argv);
- else
- return bombMain();
-}
diff --git a/fastos/src/tests/tests.h b/fastos/src/tests/tests.h
index e93081eaa53..3a6f2ef9010 100644
--- a/fastos/src/tests/tests.h
+++ b/fastos/src/tests/tests.h
@@ -1,10 +1,10 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/app.h>
#include <vespa/fastos/thread.h>
#include <cstring>
+#include <csignal>
-class BaseTest : public FastOS_Application
+class BaseTest
{
private:
BaseTest(const BaseTest&);
@@ -13,17 +13,30 @@ private:
int totallen;
bool _allOkFlag;
public:
+ int _argc;
+ char **_argv;
+
const char *okString;
const char *failString;
BaseTest ()
: totallen(70),
_allOkFlag(true),
+ _argc(0),
+ _argv(nullptr),
okString("SUCCESS"),
failString("FAILURE")
{
}
+ virtual int Main() = 0;
+
+ int Entry(int argc, char **argv) {
+ _argc = argc;
+ _argv = argv;
+ return Main();
+ }
+
virtual ~BaseTest() {};
bool allWasOk() const { return _allOkFlag; }
diff --git a/fastos/src/tests/typetest.cpp b/fastos/src/tests/typetest.cpp
index ee7f88026bc..e5d7e9ceb74 100644
--- a/fastos/src/tests/typetest.cpp
+++ b/fastos/src/tests/typetest.cpp
@@ -11,7 +11,6 @@ private:
{
TestHeader("Object Sizes (bytes)");
- Progress(true, "FastOS_Application: %d", sizeof(FastOS_Application));
Progress(true, "FastOS_DirectoryScan %d", sizeof(FastOS_DirectoryScan));
Progress(true, "FastOS_File: %d", sizeof(FastOS_File));
Progress(true, "FastOS_Runnable %d", sizeof(FastOS_Runnable));