summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2016-12-09 01:41:06 +0100
committerRichard Braun <rbraun@sceen.net>2016-12-09 01:41:06 +0100
commit39c13b3b84b34e0938220126c8f147d2b0b6ac89 (patch)
tree92accef33f04f49a01765e00ec026b092ae0c8ca /test
parent84c92cd2be8bc4aea6c14a186f79c2277f0fd4aa (diff)
Force brackets around one-line conditional statements
This change was done using astyle, with a few manual editing here and there.
Diffstat (limited to 'test')
-rw-r--r--test/test_llsync_defer.c24
-rw-r--r--test/test_pmap_update_mp.c9
-rw-r--r--test/test_sref_dirty_zeroes.c6
-rw-r--r--test/test_sref_noref.c18
-rw-r--r--test/test_xcall.c3
5 files changed, 40 insertions, 20 deletions
diff --git a/test/test_llsync_defer.c b/test/test_llsync_defer.c
index 911a88d3..0cbe68d5 100644
--- a/test/test_llsync_defer.c
+++ b/test/test_llsync_defer.c
@@ -70,23 +70,26 @@ test_alloc(void *arg)
mutex_lock(&test_lock);
for (;;) {
- while (test_pdsc != NULL)
+ while (test_pdsc != NULL) {
condition_wait(&test_condition, &test_lock);
+ }
pdsc = kmem_cache_alloc(&test_pdsc_cache);
if (pdsc != NULL) {
pdsc->addr = vm_kmem_alloc(PAGE_SIZE);
- if (pdsc->addr != NULL)
+ if (pdsc->addr != NULL) {
memset(pdsc->addr, TEST_VALIDATION_BYTE, PAGE_SIZE);
+ }
}
llsync_assign_ptr(test_pdsc, pdsc);
condition_signal(&test_condition);
- if ((i % 100000) == 0)
+ if ((i % 100000) == 0) {
printk("alloc ");
+ }
i++;
}
@@ -99,8 +102,9 @@ test_deferred_free(struct work *work)
pdsc = structof(work, struct test_pdsc, work);
- if (pdsc->addr != NULL)
+ if (pdsc->addr != NULL) {
vm_kmem_free(pdsc->addr, PAGE_SIZE);
+ }
kmem_cache_free(&test_pdsc_cache, pdsc);
}
@@ -118,8 +122,9 @@ test_free(void *arg)
mutex_lock(&test_lock);
for (;;) {
- while (test_pdsc == NULL)
+ while (test_pdsc == NULL) {
condition_wait(&test_condition, &test_lock);
+ }
pdsc = test_pdsc;
llsync_assign_ptr(test_pdsc, NULL);
@@ -131,8 +136,9 @@ test_free(void *arg)
condition_signal(&test_condition);
- if ((i % 100000) == 0)
+ if ((i % 100000) == 0) {
printk("free ");
+ }
i++;
}
@@ -159,11 +165,13 @@ test_read(void *arg)
if (s != NULL) {
for (j = 0; j < PAGE_SIZE; j++)
- if (s[j] != TEST_VALIDATION_BYTE)
+ if (s[j] != TEST_VALIDATION_BYTE) {
panic("invalid content");
+ }
- if ((i % 100000) == 0)
+ if ((i % 100000) == 0) {
printk("read ");
+ }
i++;
}
diff --git a/test/test_pmap_update_mp.c b/test/test_pmap_update_mp.c
index 3f7f505b..df20dd13 100644
--- a/test/test_pmap_update_mp.c
+++ b/test/test_pmap_update_mp.c
@@ -73,8 +73,9 @@ test_run2(void *arg)
mutex_lock(&test_lock);
- while (test_va == NULL)
+ while (test_va == NULL) {
condition_wait(&test_condition, &test_lock);
+ }
ptr = test_va;
@@ -82,9 +83,11 @@ test_run2(void *arg)
printk("page received (%p), checking page\n", ptr);
- for (i = 0; i < PAGE_SIZE; i++)
- if (ptr[i] != 'a')
+ for (i = 0; i < PAGE_SIZE; i++) {
+ if (ptr[i] != 'a') {
panic("invalid content");
+ }
+ }
vm_kmem_free(ptr, PAGE_SIZE);
printk("done\n");
diff --git a/test/test_sref_dirty_zeroes.c b/test/test_sref_dirty_zeroes.c
index 0c808c4f..e82d35d0 100644
--- a/test/test_sref_dirty_zeroes.c
+++ b/test/test_sref_dirty_zeroes.c
@@ -59,8 +59,9 @@ test_inc(void *arg)
test_transient_ref++;
condition_signal(&test_condition);
- while (test_transient_ref != 0)
+ while (test_transient_ref != 0) {
condition_wait(&test_condition, &test_lock);
+ }
mutex_unlock(&test_lock);
}
@@ -80,8 +81,9 @@ test_dec(void *arg)
for (;;) {
mutex_lock(&test_lock);
- while (test_transient_ref == 0)
+ while (test_transient_ref == 0) {
condition_wait(&test_condition, &test_lock);
+ }
test_transient_ref--;
condition_signal(&test_condition);
diff --git a/test/test_sref_noref.c b/test/test_sref_noref.c
index 394f4793..2bcd462e 100644
--- a/test/test_sref_noref.c
+++ b/test/test_sref_noref.c
@@ -77,8 +77,9 @@ test_ref(void *arg)
printk("waiting for page\n");
- while (test_obj == NULL)
+ while (test_obj == NULL) {
condition_wait(&test_condition, &test_lock);
+ }
obj = test_obj;
@@ -86,8 +87,9 @@ test_ref(void *arg)
printk("page received, manipulate reference counter\n");
- while (!test_stop)
+ while (!test_stop) {
test_manipulate_counter(obj);
+ }
printk("thread exiting\n");
}
@@ -121,8 +123,9 @@ test_run(void *arg)
nr_threads = cpu_count() + 1;
threads = kmem_alloc(sizeof(*threads) * nr_threads);
- if (threads == NULL)
+ if (threads == NULL) {
panic("kmem_alloc: %s", error_str(ERROR_NOMEM));
+ }
for (i = 0; i < nr_threads; i++) {
snprintf(name, sizeof(name), "x15_test_ref/%u", i);
@@ -134,8 +137,9 @@ test_run(void *arg)
printk("allocating page\n");
obj = vm_kmem_alloc(sizeof(*obj));
- if (obj == NULL)
+ if (obj == NULL) {
panic("vm_kmem_alloc: %s", error_str(ERROR_NOMEM));
+ }
sref_counter_init(&obj->ref_counter, test_obj_noref);
@@ -146,14 +150,16 @@ test_run(void *arg)
condition_broadcast(&test_condition);
mutex_unlock(&test_lock);
- for (loop = 0; loop < NR_LOOPS; loop++)
+ for (loop = 0; loop < NR_LOOPS; loop++) {
test_manipulate_counter(obj);
+ }
printk("stopping test, wait for threads\n");
test_stop = 1;
- for (i = 0; i < nr_threads; i++)
+ for (i = 0; i < nr_threads; i++) {
thread_join(threads[i]);
+ }
printk("releasing initial reference\n");
sref_counter_dec(&obj->ref_counter);
diff --git a/test/test_xcall.c b/test/test_xcall.c
index 4c95165c..262196d7 100644
--- a/test/test_xcall.c
+++ b/test/test_xcall.c
@@ -48,8 +48,9 @@ test_once(unsigned int cpu)
printk("cross-call on cpu%u:\n", cpu);
xcall_call(test_fn, NULL, cpu);
- if (!test_done)
+ if (!test_done) {
panic("test_done false");
+ }
}
static void