testcase: fix up tc_clock.c problem
authorEunBong Song <eunb.song@samsung.com>
Mon, 10 Apr 2017 09:58:49 +0000 (18:58 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 18 Apr 2017 03:02:13 +0000 (12:02 +0900)
clock_initialize() function should be called when os startup.
So calling this function in testcase app is not proper. So remove this tc.
tc_clock_clock_abstime2ticks() verify clock_abstime2ticks() function.
And this function multiply current seconds 2 times. And this cause overflow.
I think it's enough just 1 second add for verification.

Change-Id: Ice56ec8df934565b6d4e7019c4708522648f581a
Signed-off-by: EunBong Song <eunb.song@samsung.com>
apps/examples/testcase/le_tc/kernel/tc_clock.c

index 86a4c44..1ad32ee 100644 (file)
@@ -40,36 +40,6 @@ extern struct timespec g_basetime;
 #define SEC_10  10
 #define NSEC_20 20
 
-#define START_YEAR     2017
-#define START_MONTH    4
-#define START_DAY      1
-
-/**
-* @fn                   :tc_clock_clock_initialize
-* @brief                :Initialize the time value to match the RTC
-* @scenario             :Initialize the time value to match the RTC
-* API's covered         :clock_initialize
-* Preconditions         :none
-* Postconditions        :none
-* @return               :void
-*/
-static void tc_clock_clock_initialize(void)
-{
-       g_basetime.tv_nsec = NSEC_20;
-       time_t jdn = 0;
-
-       jdn = clock_calendar2utc(START_YEAR, START_MONTH, START_DAY);
-
-       clock_initialize();
-
-       /* g_basetime.tv_sec base time is getting as seconds into this julian day.
-        * hence we need to compare it that same */
-
-       TC_ASSERT_EQ("clock_initialize", g_basetime.tv_nsec, 0);
-       TC_ASSERT_EQ("clock_initialize", g_basetime.tv_sec, jdn * SEC_PER_DAY);
-
-       TC_SUCCESS_RESULT();
-}
 
 /**
 * @fn                   :tc_clock_clock_getres
@@ -245,8 +215,7 @@ static void tc_clock_clock_abstime2ticks(void)
        struct timespec comparison_time;
 
        clock_gettime(CLOCK_REALTIME, &base_time);
-       base_time.tv_sec *= 2;
-       comparison_time.tv_sec = base_time.tv_sec * 2;
+       comparison_time.tv_sec = base_time.tv_sec + 1;
 
        ret_chk = clock_abstime2ticks(CLOCK_REALTIME, &base_time, &base_tick);
        TC_ASSERT_EQ("clock_abstime2ticks", ret_chk, OK);
@@ -267,7 +236,6 @@ static void tc_clock_clock_abstime2ticks(void)
 
 int clock_main(void)
 {
-       tc_clock_clock_initialize();
        tc_clock_clock_timer();
        tc_clock_clock_systimer();
        tc_clock_clock_systimer64();