2 /**************************************************************************
4 * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
6 * Contact: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
7 * Contact: Andrii Sokolenko <a.sokolenko@samsung.com>
8 * Contact: Roman Marchenko <r.marchenko@samsung.com>
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the
12 * "Software"), to deal in the Software without restriction, including
13 * without limitation the rights to use, copy, modify, merge, publish,
14 * distribute, sub license, and/or sell copies of the Software, and to
15 * permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
18 * The above copyright notice and this permission notice (including the
19 * next paragraph) shall be included in all copies or substantial portions
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 **************************************************************************/
34 TEST(TBMLog, logPrintf)
36 tbm_log_enable_color(1);
37 tbm_log_enable_dlog(0);
38 tbm_log_set_debug_level(2);
39 tbm_log_set_path("/tmp/tbm.log");
40 tbm_log_print(TBM_LOG_LEVEL_ERR, "utest\n");
41 tbm_log_print(TBM_LOG_LEVEL_WRN, "utest\n");
42 tbm_log_print(TBM_LOG_LEVEL_INFO, "utest\n");
43 tbm_log_print(TBM_LOG_LEVEL_DBG, "utest\n");
44 tbm_log_set_path(NULL);
47 TEST(TBMLog, logSetPath)
49 tbm_log_enable_dlog(0);
50 tbm_log_set_path("/tmp/tbm.log");
51 tbm_log_print(TBM_LOG_LEVEL_ERR, "hello\n");
52 tbm_log_set_path(NULL);
55 TEST(TBMLog, logDlogNone)
57 tbm_log_enable_color(0);
58 tbm_log_enable_dlog(1);
59 tbm_log_set_debug_level(0);
60 tbm_log_print(TBM_LOG_LEVEL_ERR, "utest");
61 tbm_log_print(TBM_LOG_LEVEL_WRN, "utest");
62 tbm_log_print(TBM_LOG_LEVEL_INFO, "utest");
63 tbm_log_print(TBM_LOG_LEVEL_DBG, "utest");
68 tbm_log_enable_dlog(1);
69 tbm_log_print(TBM_LOG_LEVEL_ERR, "utest");
70 tbm_log_print(TBM_LOG_LEVEL_WRN, "utest");
71 tbm_log_print(TBM_LOG_LEVEL_INFO, "utest");
72 tbm_log_print(TBM_LOG_LEVEL_DBG, "utest");
75 TEST(TBMLog, logDlogNormal)
77 tbm_log_enable_dlog(1);
78 tbm_log_print(TBM_LOG_LEVEL_ERR, "utest");
79 tbm_log_print(TBM_LOG_LEVEL_WRN, "utest");
80 tbm_log_print(TBM_LOG_LEVEL_INFO, "utest");
81 tbm_log_print(TBM_LOG_LEVEL_DBG, "utest");
84 TEST(TBMLog, logDlogUnknownLevel)
86 tbm_log_enable_dlog(1);
87 tbm_log_print(UT_TBM_INVALID_VALUE, "utest");
90 TEST(TBMLog, logSetAssertLevel)
92 tbm_log_enable_dlog(1);
93 tbm_log_set_assert_level(TBM_LOG_LEVEL_ERR);
94 tbm_log_set_assert_level(TBM_LOG_LEVEL_WRN);
95 tbm_log_set_assert_level(TBM_LOG_LEVEL_INFO);
96 tbm_log_set_assert_level(TBM_LOG_LEVEL_DBG);
99 TEST(TBMLog, logPrintStdout)
101 tbm_log_print_stdout(TBM_LOG_LEVEL_ERR, "utest");
102 tbm_log_print_stdout(TBM_LOG_LEVEL_WRN, "utest");
103 tbm_log_print_stdout(TBM_LOG_LEVEL_INFO, "utest");
104 tbm_log_print_stdout(TBM_LOG_LEVEL_DBG, "utest");