summaryrefslogtreecommitdiffstats
path: root/fastos/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'fastos/src/tests')
-rw-r--r--fastos/src/tests/backtracetest.cpp24
-rw-r--r--fastos/src/tests/filetest.cpp9
-rw-r--r--fastos/src/tests/prefetchtest.cpp2
-rw-r--r--fastos/src/tests/processtest.cpp22
-rw-r--r--fastos/src/tests/sockettest.cpp9
-rw-r--r--fastos/src/tests/tests.h3
-rw-r--r--fastos/src/tests/thread_bounce_test.cpp5
-rw-r--r--fastos/src/tests/thread_joinwait_test.cpp4
-rw-r--r--fastos/src/tests/thread_mutex_test.cpp4
-rw-r--r--fastos/src/tests/thread_sleep_test.cpp4
-rw-r--r--fastos/src/tests/thread_stats_test.cpp4
-rw-r--r--fastos/src/tests/thread_test_base.hpp4
-rw-r--r--fastos/src/tests/threadtest.cpp7
-rw-r--r--fastos/src/tests/timetest.cpp7
-rw-r--r--fastos/src/tests/typetest.cpp2
-rw-r--r--fastos/src/tests/usecputest.cpp7
16 files changed, 50 insertions, 67 deletions
diff --git a/fastos/src/tests/backtracetest.cpp b/fastos/src/tests/backtracetest.cpp
index 31aa602070a..6c5d12d1366 100644
--- a/fastos/src/tests/backtracetest.cpp
+++ b/fastos/src/tests/backtracetest.cpp
@@ -1,5 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
+
#include <vespa/fastos/backtrace.h>
#include <assert.h>
#include <string.h>
@@ -63,16 +63,16 @@ public:
class Tracker2: public Tracker
{
protected:
- virtual void deepFill20();
- virtual void deepFill18();
- virtual void deepFill16();
- virtual void deepFill14();
- virtual void deepFill12();
- virtual void deepFill10();
- virtual void deepFill8();
- virtual void deepFill6();
- virtual void deepFill4();
- virtual void deepFill2();
+ void deepFill20() override;
+ void deepFill18() override;
+ void deepFill16() override;
+ void deepFill14() override;
+ void deepFill12() override;
+ void deepFill10() override;
+ void deepFill8() override;
+ void deepFill6() override;
+ void deepFill4() override;
+ void deepFill2() override;
};
@@ -104,7 +104,7 @@ public:
PrintSeparator();
}
- int Main ()
+ int Main () override
{
TestBackTrace();
return allWasOk() ? 0 : 1;
diff --git a/fastos/src/tests/filetest.cpp b/fastos/src/tests/filetest.cpp
index dcd1b224464..4e2e9c44cd2 100644
--- a/fastos/src/tests/filetest.cpp
+++ b/fastos/src/tests/filetest.cpp
@@ -1,7 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <memory>
-#include <vespa/fastos/fastos.h>
+
#include "tests.h"
+#include <vespa/fastos/file.h>
+#include <memory>
namespace {
@@ -39,7 +40,7 @@ bool createFile(const char* fileName,
class FileTest : public BaseTest
{
private:
- virtual bool useProcessStarter() const { return true; }
+ virtual bool useProcessStarter() const override { return true; }
public:
const std::string srcDir = getenv("SOURCE_DIRECTORY") ? getenv("SOURCE_DIRECTORY") : ".";
const std::string roFilename = srcDir + "/hello.txt";
@@ -792,7 +793,7 @@ public:
PrintSeparator();
}
- int Main ()
+ int Main () override
{
printf("This test should be run in the 'tests' directory.\n\n");
printf("grep for the string '%s' to detect failures.\n\n", failString);
diff --git a/fastos/src/tests/prefetchtest.cpp b/fastos/src/tests/prefetchtest.cpp
index bd86f091f09..5749ef2ae54 100644
--- a/fastos/src/tests/prefetchtest.cpp
+++ b/fastos/src/tests/prefetchtest.cpp
@@ -142,7 +142,7 @@ public:
return rc;
}
- int Main ()
+ int Main () override
{
int rc = 1;
printf("grep for the string '%s' to detect failures.\n\n", failString);
diff --git a/fastos/src/tests/processtest.cpp b/fastos/src/tests/processtest.cpp
index 0e1573dbe2e..a4b1e38b03b 100644
--- a/fastos/src/tests/processtest.cpp
+++ b/fastos/src/tests/processtest.cpp
@@ -42,7 +42,7 @@ public:
_counterLock->Unlock();
}
- void OnReceiveData (const void *data, size_t length)
+ void OnReceiveData (const void *data, size_t length) override
{
_receivedBytes += length;
if(data != NULL)
@@ -78,7 +78,7 @@ public:
{
}
- void Run (FastOS_ThreadInterface *thisThread, void *arg)
+ void Run (FastOS_ThreadInterface *thisThread, void *arg) override
{
(void)thisThread;
(void)arg;
@@ -110,15 +110,11 @@ public:
class ProcessTest : public BaseTest
{
private:
- virtual bool useProcessStarter() const { return true; }
- virtual bool useIPCHelper() const { return true; }
- ProcessTest(const ProcessTest&);
- ProcessTest& operator=(const ProcessTest&);
-
- int GetLastError ()
- {
- return errno;
- }
+ bool useProcessStarter() const override { return true; }
+ bool useIPCHelper() const override { return true; }
+ ProcessTest(const ProcessTest&);
+ ProcessTest& operator=(const ProcessTest&);
+ int GetLastError () const { return errno; }
// Flag which indicates whether an IPC message is received
// or not.
@@ -135,7 +131,7 @@ public:
{
}
- void OnReceivedIPCMessage (const void *data, size_t length)
+ void OnReceivedIPCMessage (const void *data, size_t length) override
{
// printf("Data: [%s]\n", static_cast<const char *>(data));
@@ -441,7 +437,7 @@ public:
PrintSeparator();
}
- int Main ()
+ int Main () override
{
// This process is started as either a parent or a child.
// When the parent role is desired, a child program is supplied
diff --git a/fastos/src/tests/sockettest.cpp b/fastos/src/tests/sockettest.cpp
index ad82be32312..9a655548d97 100644
--- a/fastos/src/tests/sockettest.cpp
+++ b/fastos/src/tests/sockettest.cpp
@@ -1,11 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
-#include <assert.h>
-#include <string.h>
-#include <sstream>
#include "tests.h"
-
+#include <vespa/fastos/file.h>
+#include <vespa/fastos/serversocket.h>
#define MAZE_FILE_OFFSET 1078
@@ -877,7 +874,7 @@ public:
PrintSeparator();
}
- int Main ()
+ int Main () override
{
printf("This test should be run in the 'test/workarea' directory.\n\n");
printf("grep for the string '%s' to detect failures.\n\n", failString);
diff --git a/fastos/src/tests/tests.h b/fastos/src/tests/tests.h
index c443a9fb137..cc54e66292f 100644
--- a/fastos/src/tests/tests.h
+++ b/fastos/src/tests/tests.h
@@ -1,8 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdio.h>
-#include <string.h>
#include <vespa/fastos/app.h>
+#include <vespa/fastos/socket.h>
class BaseTest : public FastOS_Application
{
diff --git a/fastos/src/tests/thread_bounce_test.cpp b/fastos/src/tests/thread_bounce_test.cpp
index c3a2673407a..4360fe5b068 100644
--- a/fastos/src/tests/thread_bounce_test.cpp
+++ b/fastos/src/tests/thread_bounce_test.cpp
@@ -1,14 +1,13 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdlib.h>
-#include <vespa/fastos/fastos.h>
#include "tests.h"
#include "job.h"
#include "thread_test_base.hpp"
+#include <vespa/fastos/time.h>
class Thread_Bounce_Test : public ThreadTestBase
{
- int Main ();
+ int Main () override;
void BounceTest(void)
{
diff --git a/fastos/src/tests/thread_joinwait_test.cpp b/fastos/src/tests/thread_joinwait_test.cpp
index e1037bec84b..3532b0c4f0c 100644
--- a/fastos/src/tests/thread_joinwait_test.cpp
+++ b/fastos/src/tests/thread_joinwait_test.cpp
@@ -1,14 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdlib.h>
-#include <vespa/fastos/fastos.h>
#include "tests.h"
#include "job.h"
#include "thread_test_base.hpp"
class Thread_JoinWait_Test : public ThreadTestBase
{
- int Main ();
+ int Main () override;
void SingleThreadJoinWaitMultipleTest(int variant)
{
diff --git a/fastos/src/tests/thread_mutex_test.cpp b/fastos/src/tests/thread_mutex_test.cpp
index aee06728406..15323c7029b 100644
--- a/fastos/src/tests/thread_mutex_test.cpp
+++ b/fastos/src/tests/thread_mutex_test.cpp
@@ -1,7 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdlib.h>
-#include <vespa/fastos/fastos.h>
#include "tests.h"
#include "job.h"
#include "thread_test_base.hpp"
@@ -11,7 +9,7 @@
class Thread_Mutex_Test : public ThreadTestBase
{
- int Main ();
+ int Main () override;
void MutexTest (bool usingMutex)
{
diff --git a/fastos/src/tests/thread_sleep_test.cpp b/fastos/src/tests/thread_sleep_test.cpp
index f08eaa404be..dd13e777958 100644
--- a/fastos/src/tests/thread_sleep_test.cpp
+++ b/fastos/src/tests/thread_sleep_test.cpp
@@ -1,14 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdlib.h>
-#include <vespa/fastos/fastos.h>
#include "tests.h"
#include "job.h"
#include "thread_test_base.hpp"
class Thread_Sleep_Test : public ThreadTestBase
{
- int Main ();
+ int Main () override;
void CreateSingleThread ()
{
diff --git a/fastos/src/tests/thread_stats_test.cpp b/fastos/src/tests/thread_stats_test.cpp
index f6993244d51..7628fb28169 100644
--- a/fastos/src/tests/thread_stats_test.cpp
+++ b/fastos/src/tests/thread_stats_test.cpp
@@ -1,7 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdlib.h>
-#include <vespa/fastos/fastos.h>
#include "tests.h"
#include "job.h"
#include "thread_test_base.hpp"
@@ -115,7 +113,7 @@ class Thread_Stats_Test : public ThreadTestBase
PrintSeparator();
}
- int Main ();
+ int Main () override;
};
int Thread_Stats_Test::Main ()
diff --git a/fastos/src/tests/thread_test_base.hpp b/fastos/src/tests/thread_test_base.hpp
index 7c8d02cb9ab..b95f3021119 100644
--- a/fastos/src/tests/thread_test_base.hpp
+++ b/fastos/src/tests/thread_test_base.hpp
@@ -17,14 +17,14 @@ public:
}
virtual ~ThreadTestBase() {};
- void PrintProgress (char *string)
+ void PrintProgress (char *string) override
{
printMutex.Lock();
BaseTest::PrintProgress(string);
printMutex.Unlock();
}
- void Run (FastOS_ThreadInterface *thread, void *arg);
+ void Run (FastOS_ThreadInterface *thread, void *arg) override;
void WaitForThreadsToFinish (Job *jobs, int count)
{
diff --git a/fastos/src/tests/threadtest.cpp b/fastos/src/tests/threadtest.cpp
index 116cea4cfd4..034af304e6e 100644
--- a/fastos/src/tests/threadtest.cpp
+++ b/fastos/src/tests/threadtest.cpp
@@ -1,11 +1,10 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdlib.h>
-#include <vespa/fastos/fastos.h>
#include "tests.h"
#include "job.h"
#include "thread_test_base.hpp"
-
+#include <vespa/fastos/time.h>
+#include <cstdlib>
#define MUTEX_TEST_THREADS 6
#define MAX_THREADS 7
@@ -13,7 +12,7 @@
class ThreadTest : public ThreadTestBase
{
- int Main ();
+ int Main () override;
void WaitForXThreadsToHaveWait (Job *jobs,
int jobCount,
diff --git a/fastos/src/tests/timetest.cpp b/fastos/src/tests/timetest.cpp
index b63ebf7fa02..9989da1e2fc 100644
--- a/fastos/src/tests/timetest.cpp
+++ b/fastos/src/tests/timetest.cpp
@@ -1,9 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdlib.h>
-#include <cmath>
-#include <vespa/fastos/fastos.h>
#include "tests.h"
+#include <vespa/fastos/time.h>
+#include <cmath>
using namespace fastos;
@@ -268,7 +267,7 @@ public:
}
- int Main ();
+ int Main () override;
};
int TimeTest::Main ()
diff --git a/fastos/src/tests/typetest.cpp b/fastos/src/tests/typetest.cpp
index 6db029a41f1..60a05f67151 100644
--- a/fastos/src/tests/typetest.cpp
+++ b/fastos/src/tests/typetest.cpp
@@ -68,7 +68,7 @@ private:
public:
virtual ~TypeTest() {};
- int Main ()
+ int Main () override
{
printf("grep for the string '%s' to detect failures.\n\n", failString);
diff --git a/fastos/src/tests/usecputest.cpp b/fastos/src/tests/usecputest.cpp
index 3ddc46aaa7e..d6215af2d62 100644
--- a/fastos/src/tests/usecputest.cpp
+++ b/fastos/src/tests/usecputest.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
+
#include "tests.h"
+#include <vespa/fastos/time.h>
class ThreadRunJob;
void UseSomeCpu(int i, ThreadRunJob *threadRunJob);
@@ -14,7 +15,7 @@ public:
someNumber * someNumber * someNumber;
}
- void Run (FastOS_ThreadInterface *thisThread, void *arg)
+ void Run (FastOS_ThreadInterface *thisThread, void *arg) override
{
(void)thisThread;
(void)arg;
@@ -40,7 +41,7 @@ public:
class UseCpuTest : public BaseTest
{
public:
- int Main ()
+ int Main () override
{
FastOS_ThreadPool pool(128*1024);
pool.NewThread(new ThreadRunJob());