tests: tickless: Make use of ztest framework

Add appropriate ztest APIs to make this legacy test case to
use ztest framework.

Signed-off-by: Punit Vara <punit.vara@intel.com>
diff --git a/tests/kernel/tickless/tickless/prj.conf b/tests/kernel/tickless/tickless/prj.conf
index d4a38aa..999abd1 100644
--- a/tests/kernel/tickless/tickless/prj.conf
+++ b/tests/kernel/tickless/tickless/prj.conf
@@ -1 +1,2 @@
 CONFIG_SYS_POWER_MANAGEMENT=y
+CONFIG_ZTEST=y
diff --git a/tests/kernel/tickless/tickless/src/test_tickless.c b/tests/kernel/tickless/tickless/src/test_tickless.c
index c948df9..c40960b 100644
--- a/tests/kernel/tickless/tickless/src/test_tickless.c
+++ b/tests/kernel/tickless/tickless/src/test_tickless.c
@@ -6,12 +6,10 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 
-/*
-DESCRIPTION
-Unit test for tickless idle feature.
- */
+/* DESCRIPTION Unit test for tickless idle feature. */
 
 #include <zephyr.h>
+#include <ztest.h>
 
 #include <misc/printk.h>
 #include <arch/cpu.h>
@@ -22,6 +20,9 @@
 
 #define SLEEP_TICKS 10
 
+static struct k_thread thread_tickless;
+static K_THREAD_STACK_DEFINE(thread_tickless_stack, STACKSIZE);
+
 #ifdef CONFIG_TICKLESS_IDLE
 extern s32_t _sys_idle_threshold_ticks;
 #endif
@@ -173,7 +174,10 @@
 	printk("Cal   time stamp: 0x%x\n", cal_tsc);
 #endif
 
-	/* Calculate percentage difference between calibrated TSC diff and measured result */
+	/*
+	 * Calculate percentage difference between
+	 * calibrated TSC diff and measured result
+	 */
 	if (diff_tsc > cal_tsc) {
 		diff_per = (100 * (diff_tsc - cal_tsc)) / cal_tsc;
 	} else {
@@ -182,12 +186,8 @@
 
 	printk("variance in time stamp diff: %d percent\n", (s32_t)diff_per);
 
-	if (diff_ticks != SLEEP_TICKS) {
-		printk("* TEST FAILED. TICK COUNT INCORRECT *\n");
-		TC_END_REPORT(TC_FAIL);
-	} else {
-		TC_END_REPORT(TC_PASS);
-	}
+	zassert_equal(diff_ticks, SLEEP_TICKS,
+			"* TEST FAILED. TICK COUNT INCORRECT *");
 
 	/* release the timer, if necessary */
 	_TIMESTAMP_CLOSE();
@@ -198,5 +198,19 @@
 
 }
 
-K_THREAD_DEFINE(TICKLESS_THREAD, STACKSIZE, ticklessTestThread, NULL, NULL,
-		NULL, PRIORITY, 0, K_NO_WAIT);
+void test_tickless(void)
+{
+	k_thread_create(&thread_tickless, thread_tickless_stack,
+			STACKSIZE,
+			(k_thread_entry_t) ticklessTestThread,
+			NULL, NULL, NULL,
+			PRIORITY, 0, K_NO_WAIT);
+	k_sleep(4000);
+}
+
+void test_main(void)
+{
+	ztest_test_suite(test_tick_less,
+			ztest_unit_test(test_tickless));
+	ztest_run_test_suite(test_tick_less);
+}