Skip to content

Commit

Permalink
tests: Remove newline character
Browse files Browse the repository at this point in the history
Remove new line character from all zassert_*
messages. Following script has been used to do this.

https://github.com/punitvara/scripts/blob/master/remove_newlinech.py

zassert test framework adds newlines character implicitly.

issue: #7170

Signed-off-by: Punit Vara <punit.vara@intel.com>
  • Loading branch information
punitvara authored and nashif committed May 23, 2018
1 parent e7468fb commit 7a3ace3
Show file tree
Hide file tree
Showing 60 changed files with 527 additions and 527 deletions.
4 changes: 2 additions & 2 deletions tests/drivers/adc/adc_simple/src/main.c
Expand Up @@ -70,7 +70,7 @@ static void test_adc(void)
unsigned int bufi0 = ~0, bufi;

adc = device_get_binding(ADC_DEVICE_NAME);
zassert_not_null(adc, "Cannot get adc controller\n");
zassert_not_null(adc, "Cannot get adc controller");

adc_enable(adc);
while (loops--) {
Expand All @@ -79,7 +79,7 @@ static void test_adc(void)
sample.buffer = (void *) seq_buffer[bufi];
result = adc_read(adc, &table);
zassert_equal(result, 0, "Sampling could not proceed, "
"an error occurred\n");
"an error occurred");
printk("loop %u: sampling done to buffer #%u\n", loops, bufi);
_print_sample_in_hex(seq_buffer[bufi], BUFFER_SIZE);
if (bufi0 != ~0) {
Expand Down
32 changes: 16 additions & 16 deletions tests/kernel/context/src/main.c
Expand Up @@ -331,7 +331,7 @@ static void test_kernel_interrupts(disable_int_func disable_int,
enable_int(imask);

zassert_equal(tick2, tick,
"tick advanced with interrupts locked\n");
"tick advanced with interrupts locked");

/* Now repeat with interrupts unlocked. */
for (i = 0; i < count; i++) {
Expand All @@ -343,7 +343,7 @@ static void test_kernel_interrupts(disable_int_func disable_int,

tick2 = _tick_get_32();
zassert_not_equal(tick, tick2,
"tick didn't advance as expected\n");
"tick didn't advance as expected");
}

/**
Expand All @@ -368,26 +368,26 @@ static void test_kernel_ctx_task(void)
/* isr_info is modified by the isr_handler routine */
isr_handler_trigger();

zassert_false(isr_info.error, "ISR detected an error\n");
zassert_false(isr_info.error, "ISR detected an error");

zassert_equal(isr_info.data, (void *)self_thread_id,
"ISR context ID mismatch\n");
"ISR context ID mismatch");

TC_PRINT("Testing k_is_in_isr() from an ISR\n");
isr_info.command = EXEC_CTX_TYPE_CMD;
isr_info.error = 0;
isr_handler_trigger();

zassert_false(isr_info.error, "ISR detected an error\n");
zassert_false(isr_info.error, "ISR detected an error");

zassert_equal(isr_info.value, K_ISR,
"isr_info.value was not K_ISR\n");
"isr_info.value was not K_ISR");

TC_PRINT("Testing k_is_in_isr() from a preemptible thread\n");
zassert_false(k_is_in_isr(), "Should not be in ISR context\n");
zassert_false(k_is_in_isr(), "Should not be in ISR context");

zassert_false(_current->base.prio < 0,
"Current thread should have preemptible priority\n");
"Current thread should have preemptible priority");

}

Expand Down Expand Up @@ -727,7 +727,7 @@ static void test_timeout(void)

rv = k_sem_take(&reply_timeout, timeout * 2);

zassert_false(rv, " *** task timed out waiting for " "k_busy_wait()\n");
zassert_false(rv, " *** task timed out waiting for " "k_busy_wait()");

/* test k_sleep() */

Expand All @@ -741,7 +741,7 @@ static void test_timeout(void)

rv = k_sem_take(&reply_timeout, timeout * 2);
zassert_equal(rv, 0, " *** task timed out waiting for thread on "
"k_sleep().\n");
"k_sleep().");

/* test k_thread_create() without cancellation */
TC_PRINT("Testing k_thread_create() without cancellation\n");
Expand All @@ -757,7 +757,7 @@ static void test_timeout(void)
for (i = 0; i < NUM_TIMEOUT_THREADS; i++) {
data = k_fifo_get(&timeout_order_fifo, 750);
zassert_not_null(data, " *** timeout while waiting for"
" delayed thread\n");
" delayed thread");

zassert_equal(data->timeout_order, i,
" *** wrong delayed thread ran (got %d, "
Expand All @@ -770,7 +770,7 @@ static void test_timeout(void)
/* ensure no more thread fire */
data = k_fifo_get(&timeout_order_fifo, 750);

zassert_false(data, " *** got something unexpected in the fifo\n");
zassert_false(data, " *** got something unexpected in the fifo");

/* test k_thread_create() with cancellation */
TC_PRINT("Testing k_thread_create() with cancellations\n");
Expand Down Expand Up @@ -816,7 +816,7 @@ static void test_timeout(void)
data = k_fifo_get(&timeout_order_fifo, 2750);

zassert_not_null(data, " *** timeout while waiting for"
" delayed thread\n");
" delayed thread");

zassert_equal(data->timeout_order, i,
" *** wrong delayed thread ran (got %d, "
Expand All @@ -833,7 +833,7 @@ static void test_timeout(void)

/* ensure no more thread fire */
data = k_fifo_get(&timeout_order_fifo, 750);
zassert_false(data, " *** got something unexpected in the fifo\n");
zassert_false(data, " *** got something unexpected in the fifo");

}

Expand All @@ -859,7 +859,7 @@ void test_context(void)

TC_PRINT("Initializing kernel objects\n");
rv = kernel_init_objects();
zassert_equal(rv, TC_PASS, "failure kernel objects\n");
zassert_equal(rv, TC_PASS, "failure kernel objects");

TC_PRINT("Testing interrupt locking and unlocking\n");
TC_START("test_kernel_interrupts");
Expand All @@ -886,7 +886,7 @@ void test_context(void)
NULL, K_PRIO_COOP(THREAD_PRIORITY), 0, 0);

zassert_equal(thread_evidence, 1,
" - thread did not execute as expected!\n");
" - thread did not execute as expected!");

/*
* The thread ran, now wake it so it can test k_current_get and
Expand Down
10 changes: 5 additions & 5 deletions tests/kernel/fatal/src/main.c
Expand Up @@ -160,7 +160,7 @@ void test_fatal(void)
(k_thread_entry_t)alt_thread1,
NULL, NULL, NULL, K_PRIO_COOP(PRIORITY), 0,
K_NO_WAIT);
zassert_not_equal(rv, TC_FAIL, "thread was not aborted\n");
zassert_not_equal(rv, TC_FAIL, "thread was not aborted");
#else
/*
* We want the native OS to handle segfaults so we can debug it
Expand All @@ -179,7 +179,7 @@ void test_fatal(void)
zassert_equal(crash_reason, _NANO_ERR_KERNEL_OOPS,
"bad reason code got %d expected %d\n",
crash_reason, _NANO_ERR_KERNEL_OOPS);
zassert_not_equal(rv, TC_FAIL, "thread was not aborted\n");
zassert_not_equal(rv, TC_FAIL, "thread was not aborted");

TC_PRINT("test alt thread 3: initiate kernel panic\n");
k_thread_create(&alt_thread, alt_stack,
Expand All @@ -191,7 +191,7 @@ void test_fatal(void)
zassert_equal(crash_reason, _NANO_ERR_KERNEL_PANIC,
"bad reason code got %d expected %d\n",
crash_reason, _NANO_ERR_KERNEL_PANIC);
zassert_not_equal(rv, TC_FAIL, "thread was not aborted\n");
zassert_not_equal(rv, TC_FAIL, "thread was not aborted");

#ifndef CONFIG_ARCH_POSIX
TC_PRINT("test stack overflow - timer irq\n");
Expand Down Expand Up @@ -219,7 +219,7 @@ void test_fatal(void)
"bad reason code got %d expected %d\n",
crash_reason, _NANO_ERR_STACK_CHK_FAIL);
#endif
zassert_not_equal(rv, TC_FAIL, "thread was not aborted\n");
zassert_not_equal(rv, TC_FAIL, "thread was not aborted");

/* Stack sentinel has to be invoked, make sure it happens during
* a context switch. Also ensure HW-based solutions can run more
Expand All @@ -244,7 +244,7 @@ void test_fatal(void)
"bad reason code got %d expected %d\n",
crash_reason, _NANO_ERR_STACK_CHK_FAIL);
#endif
zassert_not_equal(rv, TC_FAIL, "thread was not aborted\n");
zassert_not_equal(rv, TC_FAIL, "thread was not aborted");
#else
TC_PRINT("test stack overflow - skipped for POSIX arch\n");
/*
Expand Down
2 changes: 1 addition & 1 deletion tests/kernel/init/src/main.c
Expand Up @@ -19,7 +19,7 @@ void verify_bootdelay(void)
/* compare this with the boot delay specified */
zassert_true(SYS_CLOCK_HW_CYCLES_TO_NS64(current_cycles) >=
(CONFIG_BOOT_DELAY * NSEC_PER_USEC * USEC_PER_MSEC),
"boot delay not executed\n");
"boot delay not executed");
}

/*test case main entry*/
Expand Down
4 changes: 2 additions & 2 deletions tests/kernel/irq_offload/src/main.c
Expand Up @@ -25,7 +25,7 @@ static void offload_function(void *param)
u32_t x = (u32_t)param;

/* Make sure we're in IRQ context */
zassert_true(_is_in_isr(), "Not in IRQ context!\n");
zassert_true(_is_in_isr(), "Not in IRQ context!");

sentinel = x;
}
Expand All @@ -42,7 +42,7 @@ void test_irq_offload(void)
irq_offload(offload_function, (void *)SENTINEL_VALUE);

zassert_equal(sentinel, SENTINEL_VALUE,
"irq_offload() didn't work properly\n");
"irq_offload() didn't work properly");
}


Expand Down
26 changes: 13 additions & 13 deletions tests/kernel/mem_pool/mem_pool/src/main.c
Expand Up @@ -203,19 +203,19 @@ static void test_pool_block_get_timeout(void)

rv = k_mem_pool_alloc(&POOL_ID, &helper_block, 3148, 5);
zassert_true(rv == 0,
"Failed to get size 3148 byte block from POOL_ID\n");
"Failed to get size 3148 byte block from POOL_ID");

rv = k_mem_pool_alloc(&POOL_ID, &block, 3148, K_NO_WAIT);
zassert_true(rv == -ENOMEM, "Unexpectedly got size 3148 "
"byte block from POOL_ID\n");
"byte block from POOL_ID");

k_sem_give(&HELPER_SEM); /* Activate helper_task */
rv = k_mem_pool_alloc(&POOL_ID, &block, 3148, 20);
zassert_true(rv == 0, "Failed to get size 3148 byte block from POOL_ID\n");
zassert_true(rv == 0, "Failed to get size 3148 byte block from POOL_ID");

rv = k_sem_take(&REGRESS_SEM, K_NO_WAIT);
zassert_true(rv == 0, "Failed to get size 3148 "
"byte block within 20 ticks\n");
"byte block within 20 ticks");

k_mem_pool_free(&block);

Expand All @@ -235,13 +235,13 @@ static void test_pool_block_get_wait(void)

switch (evidence) {
case 0:
zassert_true(evidence == 0, "k_mem_pool_alloc(128) did not block!\n");
zassert_true(evidence == 0, "k_mem_pool_alloc(128) did not block!");
case 1:
break;
case 2:
default:
zassert_true(1, "Rescheduling did not occur "
"after k_mem_pool_free()\n");
"after k_mem_pool_free()");
}

k_mem_pool_free(&block_list[1]);
Expand Down Expand Up @@ -283,22 +283,22 @@ static void test_pool_malloc(void)

/* allocate a large block (which consumes the entire pool buffer) */
block[0] = k_malloc(150);
zassert_not_null(block[0], "150 byte allocation failed\n");
zassert_not_null(block[0], "150 byte allocation failed");

/* ensure a small block can no longer be allocated */
block[1] = k_malloc(16);
zassert_is_null(block[1], "16 byte allocation did not fail\n");
zassert_is_null(block[1], "16 byte allocation did not fail");

/* return the large block */
k_free(block[0]);

/* allocate a small block (triggers block splitting)*/
block[0] = k_malloc(16);
zassert_not_null(block[0], "16 byte allocation 0 failed\n");
zassert_not_null(block[0], "16 byte allocation 0 failed");

/* ensure a large block can no longer be allocated */
block[1] = k_malloc(80);
zassert_is_null(block[1], "80 byte allocation did not fail\n");
zassert_is_null(block[1], "80 byte allocation did not fail");

/* ensure all remaining small blocks can be allocated */
for (j = 1; j < 4; j++) {
Expand All @@ -307,7 +307,7 @@ static void test_pool_malloc(void)
}

/* ensure a small block can no longer be allocated */
zassert_is_null(k_malloc(8), "8 byte allocation did not fail\n");
zassert_is_null(k_malloc(8), "8 byte allocation did not fail");

/* return the small blocks to pool in a "random" order */
k_free(block[2]);
Expand All @@ -317,10 +317,10 @@ static void test_pool_malloc(void)

/* allocate large block (triggers autodefragmentation) */
block[0] = k_malloc(100);
zassert_not_null(block[0], "100 byte allocation failed\n");
zassert_not_null(block[0], "100 byte allocation failed");

/* ensure a small block can no longer be allocated */
zassert_is_null(k_malloc(32), "32 byte allocation did not fail\n");
zassert_is_null(k_malloc(32), "32 byte allocation did not fail");

/* ensure overflow detection is working */
zassert_is_null(k_malloc(0xffffffff), "overflow check failed");
Expand Down
4 changes: 2 additions & 2 deletions tests/kernel/mem_protect/mem_protect/src/mem_domain.c
Expand Up @@ -197,7 +197,7 @@ static void user_thread_entry_ro(void *p1, void *p2, void *p3)
mem_domain_buf1[0] = 10;

zassert_unreachable("The user thread is allowed to access a read only"
" partition of a memory domain\n");
" partition of a memory domain");
}

void test_mem_domain_partitions_user_ro(void)
Expand Down Expand Up @@ -524,6 +524,6 @@ void test_mem_domain_destroy(void)
&mem_domain1, "The thread has reference to"
" memory domain which is already destroyed");
} else {
zassert_unreachable("k_mem_domain_add_thread() failed\n");
zassert_unreachable("k_mem_domain_add_thread() failed");
}
}
2 changes: 1 addition & 1 deletion tests/kernel/mem_protect/obj_validation/src/main.c
Expand Up @@ -86,7 +86,7 @@ void test_generic_object(void)
for (int i = 0; i < SEM_ARRAY_SIZE; i++) {
object_permission_checks(&semarray[i], false);
dyn_sem[i] = k_object_alloc(K_OBJ_SEM);
zassert_not_null(dyn_sem[i], "couldn't allocate semaphore\n");
zassert_not_null(dyn_sem[i], "couldn't allocate semaphore");
/* Give an extra reference to another thread so the object
* doesn't disappear if we revoke our own
*/
Expand Down

0 comments on commit 7a3ace3

Please sign in to comment.