summaryrefslogtreecommitdiffstats
path: root/vespamalloc/src/tests/test1
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-01-07 08:38:58 +0100
committerGitHub <noreply@github.com>2017-01-07 08:38:58 +0100
commit814567bf2fee941a77b8685171fedf1f7a825800 (patch)
tree7ce8a750abf4bbc1ade1fd8407e8fdf8bfe1a677 /vespamalloc/src/tests/test1
parent8b774509af8df6d2bd5825796d8a066a38db93e1 (diff)
Revert "Balder/vespamalloc should not depend on anything else rebased 2"
Diffstat (limited to 'vespamalloc/src/tests/test1')
-rw-r--r--vespamalloc/src/tests/test1/CMakeLists.txt1
-rw-r--r--vespamalloc/src/tests/test1/testatomic.cpp26
2 files changed, 7 insertions, 20 deletions
diff --git a/vespamalloc/src/tests/test1/CMakeLists.txt b/vespamalloc/src/tests/test1/CMakeLists.txt
index 3120f1d39d0..205de0f96fc 100644
--- a/vespamalloc/src/tests/test1/CMakeLists.txt
+++ b/vespamalloc/src/tests/test1/CMakeLists.txt
@@ -3,6 +3,5 @@ vespa_add_executable(vespamalloc_testatomic_app TEST
SOURCES
testatomic.cpp
DEPENDS
- atomic
)
vespa_add_test(NAME vespamalloc_testatomic_app NO_VALGRIND COMMAND vespamalloc_testatomic_app)
diff --git a/vespamalloc/src/tests/test1/testatomic.cpp b/vespamalloc/src/tests/test1/testatomic.cpp
index 78d94429a3f..1222493446c 100644
--- a/vespamalloc/src/tests/test1/testatomic.cpp
+++ b/vespamalloc/src/tests/test1/testatomic.cpp
@@ -1,8 +1,10 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/thread.h>
+#include <vespa/fastos/fastos.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/atomic.h>
-#include <vespamalloc/malloc/allocchunk.h>
+#include <vector>
+
+using vespalib::Atomic;
class Test : public vespalib::TestApp
{
@@ -37,10 +39,10 @@ void Test::testSwap(T initial)
{
T value(initial);
- ASSERT_TRUE(vespalib::Atomic::cmpSwap(&value, initial+1, initial));
+ ASSERT_TRUE(Atomic::cmpSwap(&value, initial+1, initial));
ASSERT_TRUE(value == initial+1);
- ASSERT_TRUE(!vespalib::Atomic::cmpSwap(&value, initial+2, initial));
+ ASSERT_TRUE(!Atomic::cmpSwap(&value, initial+2, initial));
ASSERT_TRUE(value == initial+1);
}
@@ -89,7 +91,7 @@ template <typename T>
void Stress<T>::stressSwap(T & value)
{
for (T old = value; old > 0; old = value) {
- if (vespalib::Atomic::cmpSwap(&value, old-1, old)) {
+ if (Atomic::cmpSwap(&value, old-1, old)) {
_successCount++;
} else {
_failedCount++;
@@ -101,20 +103,6 @@ int Test::Main()
{
TEST_INIT("atomic");
- {
- std::atomic<uint32_t> uint32V;
- ASSERT_TRUE(uint32V.is_lock_free());
- }
- {
- std::atomic<uint64_t> uint64V;
- ASSERT_TRUE(uint64V.is_lock_free());
- }
- {
- std::atomic<vespamalloc::TaggedPtr> taggedPtr;
- ASSERT_EQUAL(16, sizeof(vespamalloc::TaggedPtr));
- ASSERT_TRUE(taggedPtr.is_lock_free());
- }
-
testSwap<uint32_t>(6);
testSwap<uint32_t>(7);
testSwap<uint32_t>(uint32_t(-6));