aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-05-14 10:02:03 -0700
committerElliott Hughes <enh@google.com>2014-05-14 10:02:03 -0700
commit1728b2396591853345507a063ed6075dfd251706 (patch)
tree7083cd234073afa5179b94b3d978550c890af90c /tests
parentbac795586bbc5dcbe886d8d781710f60c4c19d9b (diff)
downloadandroid_bionic-1728b2396591853345507a063ed6075dfd251706.tar.gz
android_bionic-1728b2396591853345507a063ed6075dfd251706.tar.bz2
android_bionic-1728b2396591853345507a063ed6075dfd251706.zip
Switch to g_ for globals.
That's what the Google style guide recommends, and we're starting to get a mix. Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
Diffstat (limited to 'tests')
-rw-r--r--tests/dlfcn_test.cpp8
-rw-r--r--tests/pthread_test.cpp30
-rw-r--r--tests/signal_test.cpp8
-rw-r--r--tests/unistd_test.cpp8
4 files changed, 27 insertions, 27 deletions
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index b31d7e452..3b3c0f69a 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -27,9 +27,9 @@
#define ASSERT_SUBSTR(needle, haystack) \
ASSERT_PRED_FORMAT2(::testing::IsSubstring, needle, haystack)
-static bool gCalled = false;
+static bool g_called = false;
extern "C" void DlSymTestFunction() {
- gCalled = true;
+ g_called = true;
}
TEST(dlfcn, dlsym_in_self) {
@@ -43,9 +43,9 @@ TEST(dlfcn, dlsym_in_self) {
void (*function)() = reinterpret_cast<void(*)()>(sym);
- gCalled = false;
+ g_called = false;
function();
- ASSERT_TRUE(gCalled);
+ ASSERT_TRUE(g_called);
ASSERT_EQ(0, dlclose(self));
}
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 6a5e4a6f4..b9a0c2c8a 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -560,27 +560,27 @@ TEST(pthread, pthread_rwlock_smoke) {
ASSERT_EQ(0, pthread_rwlock_destroy(&l));
}
-static int gOnceFnCallCount = 0;
+static int g_once_fn_call_count = 0;
static void OnceFn() {
- ++gOnceFnCallCount;
+ ++g_once_fn_call_count;
}
TEST(pthread, pthread_once_smoke) {
pthread_once_t once_control = PTHREAD_ONCE_INIT;
ASSERT_EQ(0, pthread_once(&once_control, OnceFn));
ASSERT_EQ(0, pthread_once(&once_control, OnceFn));
- ASSERT_EQ(1, gOnceFnCallCount);
+ ASSERT_EQ(1, g_once_fn_call_count);
}
-static int gAtForkPrepareCalls = 0;
-static void AtForkPrepare1() { gAtForkPrepareCalls = (gAtForkPrepareCalls << 4) | 1; }
-static void AtForkPrepare2() { gAtForkPrepareCalls = (gAtForkPrepareCalls << 4) | 2; }
-static int gAtForkParentCalls = 0;
-static void AtForkParent1() { gAtForkParentCalls = (gAtForkParentCalls << 4) | 1; }
-static void AtForkParent2() { gAtForkParentCalls = (gAtForkParentCalls << 4) | 2; }
-static int gAtForkChildCalls = 0;
-static void AtForkChild1() { gAtForkChildCalls = (gAtForkChildCalls << 4) | 1; }
-static void AtForkChild2() { gAtForkChildCalls = (gAtForkChildCalls << 4) | 2; }
+static int g_atfork_prepare_calls = 0;
+static void AtForkPrepare1() { g_atfork_prepare_calls = (g_atfork_prepare_calls << 4) | 1; }
+static void AtForkPrepare2() { g_atfork_prepare_calls = (g_atfork_prepare_calls << 4) | 2; }
+static int g_atfork_parent_calls = 0;
+static void AtForkParent1() { g_atfork_parent_calls = (g_atfork_parent_calls << 4) | 1; }
+static void AtForkParent2() { g_atfork_parent_calls = (g_atfork_parent_calls << 4) | 2; }
+static int g_atfork_child_calls = 0;
+static void AtForkChild1() { g_atfork_child_calls = (g_atfork_child_calls << 4) | 1; }
+static void AtForkChild2() { g_atfork_child_calls = (g_atfork_child_calls << 4) | 2; }
TEST(pthread, pthread_atfork) {
ASSERT_EQ(0, pthread_atfork(AtForkPrepare1, AtForkParent1, AtForkChild1));
@@ -591,13 +591,13 @@ TEST(pthread, pthread_atfork) {
// Child and parent calls are made in the order they were registered.
if (pid == 0) {
- ASSERT_EQ(0x12, gAtForkChildCalls);
+ ASSERT_EQ(0x12, g_atfork_child_calls);
_exit(0);
}
- ASSERT_EQ(0x12, gAtForkParentCalls);
+ ASSERT_EQ(0x12, g_atfork_parent_calls);
// Prepare calls are made in the reverse order.
- ASSERT_EQ(0x21, gAtForkPrepareCalls);
+ ASSERT_EQ(0x21, g_atfork_prepare_calls);
}
TEST(pthread, pthread_attr_getscope) {
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index af9896409..89b808838 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -146,10 +146,10 @@ TEST(signal, sigwait) {
ASSERT_EQ(SIGALRM, received_signal);
}
-static int gSigSuspendTestHelperCallCount = 0;
+static int g_sigsuspend_test_helper_call_count = 0;
static void SigSuspendTestHelper(int) {
- ++gSigSuspendTestHelperCallCount;
+ ++g_sigsuspend_test_helper_call_count;
}
TEST(signal, sigsuspend_sigpending) {
@@ -172,7 +172,7 @@ TEST(signal, sigsuspend_sigpending) {
// Raise SIGALRM and check our signal handler wasn't called.
raise(SIGALRM);
- ASSERT_EQ(0, gSigSuspendTestHelperCallCount);
+ ASSERT_EQ(0, g_sigsuspend_test_helper_call_count);
// We should now have a pending SIGALRM but nothing else.
sigemptyset(&pending);
@@ -188,7 +188,7 @@ TEST(signal, sigsuspend_sigpending) {
ASSERT_EQ(-1, sigsuspend(&not_SIGALRM));
ASSERT_EQ(EINTR, errno);
// ...and check that we now receive our pending SIGALRM.
- ASSERT_EQ(1, gSigSuspendTestHelperCallCount);
+ ASSERT_EQ(1, g_sigsuspend_test_helper_call_count);
// Restore the original set.
ASSERT_EQ(0, sigprocmask(SIG_SETMASK, &original_set, NULL));
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index ff05039fe..3f3186128 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -114,18 +114,18 @@ TEST(unistd, ftruncate64) {
ASSERT_EQ(123, sb.st_size);
}
-static bool gPauseTestFlag = false;
+static bool g_pause_test_flag = false;
static void PauseTestSignalHandler(int) {
- gPauseTestFlag = true;
+ g_pause_test_flag = true;
}
TEST(unistd, pause) {
ScopedSignalHandler handler(SIGALRM, PauseTestSignalHandler);
alarm(1);
- ASSERT_FALSE(gPauseTestFlag);
+ ASSERT_FALSE(g_pause_test_flag);
ASSERT_EQ(-1, pause());
- ASSERT_TRUE(gPauseTestFlag);
+ ASSERT_TRUE(g_pause_test_flag);
}
TEST(unistd, read) {