aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-16 13:22:56 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-16 13:22:56 +0000
commit96cbd2c4d2ea7e138b65923a46fb77bc096a6782 (patch)
tree34f0bced44887d5d2fe07bfba5e484982af8bfc4 /tests
parente3f84f3911d6ab1c99030fef3200199755251d51 (diff)
Revert "Add a method to atomic add."
This reverts commit eb539cf92f487daf9567ffbbba6b6653406d43ae. BUG= TEST= Review URL: https://codereview.appspot.com/6395051 git-svn-id: http://skia.googlecode.com/svn/trunk@4615 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/AtomicTest.cpp60
1 files changed, 0 insertions, 60 deletions
diff --git a/tests/AtomicTest.cpp b/tests/AtomicTest.cpp
deleted file mode 100644
index a9ab8d2279..0000000000
--- a/tests/AtomicTest.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkThread.h"
-#include "SkThreadUtils.h"
-#include "SkTypes.h"
-#include "Test.h"
-
-struct AddInfo {
- int32_t valueToAdd;
- int timesToAdd;
- unsigned int processorAffinity;
-};
-
-static int32_t base = 0;
-
-static AddInfo gAdds[] = {
- { 3, 100, 23 },
- { 2, 200, 2 },
- { 7, 150, 17 },
-};
-
-static void addABunchOfTimes(void* data) {
- AddInfo* addInfo = static_cast<AddInfo*>(data);
- for (int i = 0; i < addInfo->timesToAdd; i++) {
- sk_atomic_add(&base, addInfo->valueToAdd);
- }
-}
-
-static void test_atomicAddTests(skiatest::Reporter* reporter) {
- int32_t total = base;
- SkThread* threads[SK_ARRAY_COUNT(gAdds)];
- for (size_t i = 0; i < SK_ARRAY_COUNT(gAdds); i++) {
- total += gAdds[i].valueToAdd * gAdds[i].timesToAdd;
- }
- // Start the threads
- for (size_t i = 0; i < SK_ARRAY_COUNT(gAdds); i++) {
- threads[i] = new SkThread(addABunchOfTimes, &gAdds[i]);
- threads[i]->setProcessorAffinity(gAdds[i].processorAffinity);
- threads[i]->start();
- }
-
- // Now end the threads
- for (size_t i = 0; i < SK_ARRAY_COUNT(gAdds); i++) {
- threads[i]->join();
- delete threads[i];
- }
- REPORTER_ASSERT(reporter, total == base);
- // Ensure that the returned value from sk_atomic_add is correct.
- int32_t valueToModify = 3;
- const int32_t originalValue = valueToModify;
- REPORTER_ASSERT(reporter, originalValue == sk_atomic_add(&valueToModify, 7));
-}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS("AtomicAdd", AtomicAddTestClass, test_atomicAddTests)