apps/testcase: refactor codes
authorsunghan <sh924.chang@samsung.com>
Thu, 12 Oct 2017 11:52:04 +0000 (20:52 +0900)
committersunghan <sh924.chang@samsung.com>
Thu, 12 Oct 2017 12:41:10 +0000 (21:41 +0900)
1. remove unused definition, RETURN_ERR
2. remove unused header file, tc_internal.h on systemio itc
3. fix incorrect definition of preventing duplicated-including header file
4. move a location of including header to inside definition
5. remove unnecessary relative path of header, tc_common.h
6. remove definition of same global variables and initialize them before using,
  total_pass and total_fail

12 files changed:
apps/examples/testcase/le_tc/kernel/tc_internal.h
apps/examples/testcase/le_tc/kernel/tc_signal.c
apps/examples/testcase/le_tc/network/tc_internal.h
apps/examples/testcase/ta_tc/arastorage/itc/itc_arastorage_main.c
apps/examples/testcase/ta_tc/device_management/itc/itc_internal.h
apps/examples/testcase/ta_tc/device_management/utc/utc_dm_lwm2m.c
apps/examples/testcase/ta_tc/device_management/utc/utc_dm_main.c
apps/examples/testcase/ta_tc/device_management/utc/utc_internal.h
apps/examples/testcase/ta_tc/systemio/itc/itc_internal.h
apps/examples/testcase/ta_tc/systemio/itc/tc_internal.h [deleted file]
apps/examples/testcase/ta_tc/systemio/utc/utc_internal.h
apps/examples/testcase/ta_tc/systemio/utc/utc_sysio_main.c

index f11ad85..25c041c 100644 (file)
@@ -22,8 +22,6 @@
 #ifndef __EXAMPLES_TESTCASE_KERNEL_TC_INTERNAL_H
 #define __EXAMPLES_TESTCASE_KERNEL_TC_INTERNAL_H
 
-#define RETURN_ERR return
-
 #ifdef CONFIG_CPP_HAVE_VARARGS
 
 #ifdef CONFIG_DEBUG_TC_KN
index b33a367..9d66bbe 100644 (file)
@@ -367,7 +367,7 @@ errout_with_mask:
        sigprocmask(SIG_SETMASK, &saved, NULL);
 errout:
 
-       RETURN_ERR;
+       return;
 }
 
 /**
index 276cf7b..39338d7 100644 (file)
@@ -22,8 +22,6 @@
 #ifndef __EXAMPLES_TESTCASE_NETWORK_TC_INTERNAL_H
 #define __EXAMPLES_TESTCASE_NETWORK_TC_INTERNAL_H
 
-#define RETURN_ERR return
-
 #include "tc_common.h"
 
 extern int total_pass;
index 0660b11..2bed6a4 100644 (file)
@@ -24,7 +24,7 @@
 #include <arastorage/arastorage.h>
 #include <apps/shell/tash.h>
 #include <tinyara/fs/fs_utils.h>
-#include "../../../tc_common.h"
+#include "tc_common.h"
 
 /****************************************************************************
  * Definitions
index 24a4787..4c953b7 100644 (file)
 /// @file tc_internal.h
 
 /// @brief Header file for Kernel TestCase Example
-#include "../../../tc_common.h"
-#ifndef __EXAMPLES_TESTCASE_DM_TC_INTERNAL_H
-#define __EXAMPLES_TESTCASE_DM_TC_INTERNAL_H
+#ifndef __EXAMPLES_TESTCASE_DM_ITC_INTERNAL_H
+#define __EXAMPLES_TESTCASE_DM_ITC_INTERNAL_H
 
-#define RETURN_ERR return
+#include "tc_common.h"
 
 #define DM_ITC_PRINT printf
 
-
 /**********************************************************
 * ITC Function Declarations
 **********************************************************/
@@ -83,5 +81,5 @@ int  itc_dm_conn_regi_unreg_linkdown_main(void);
 #endif
 #endif
 
-#endif /* __EXAMPLES_TESTCASE_KERNEL_TC_INTERNAL_H */
+#endif /* __EXAMPLES_TESTCASE_DM_ITC_INTERNAL_H */
 
index 9df8176..fa32fe7 100644 (file)
@@ -29,7 +29,7 @@
 #include "utc_internal.h"
 #include "dm_lwm2m.h"
 #include "dm_error.h"
-#include "../../../tc_common.h"
+#include "tc_common.h"
 
 #define UTC_DM_IPADDR_LEN 20
 #define UTC_DM_SERVER_PORT 6
index 36de28b..2b93899 100644 (file)
@@ -32,9 +32,6 @@
 
 #define NET_DEVNAME "wl1"
 
-int total_pass = 0;
-int total_fail = 0;
-
 extern sem_t tc_sem;
 extern int working_tc;
 
@@ -158,6 +155,10 @@ int utc_dm_main(int argc, char *argv[])
 {
        sem_wait(&tc_sem);
        working_tc++;
+
+       total_pass = 0;
+       total_fail = 0;
+
 #ifndef CONFIG_DM_WIFI
        printf("=== Please Setup WiFi Info ===\n");
        return 0;
index e4a700c..6efffa9 100644 (file)
 /// @file tc_internal.h
 
 /// @brief Header file for Kernel TestCase Example
-#ifndef __EXAMPLES_TESTCASE_DM_TC_INTERNAL_H
-#define __EXAMPLES_TESTCASE_DM_TC_INTERNAL_H
+#ifndef __EXAMPLES_TESTCASE_DM_UTC_INTERNAL_H
+#define __EXAMPLES_TESTCASE_DM_UTC_INTERNAL_H
 
-#include "../../../tc_common.h"
-
-#define RETURN_ERR return
+#include "tc_common.h"
 
 #define DM_TC_PRINT printf
 
@@ -89,5 +87,5 @@ int   dm_conn_unregi_linkup_main(void);
 int    dm_conn_unregi_linkdown_main(void);
 #endif
 
-#endif /* __EXAMPLES_TESTCASE_KERNEL_TC_INTERNAL_H */
+#endif /* __EXAMPLES_TESTCASE_DM_UTC_INTERNAL_H */
 
index 6f6eaea..cd5fb78 100644 (file)
 /// @file itc_internal.h
 
 /// @brief Header file for System IO TestCase Example
-#include "../../../tc_common.h"
-#ifndef __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H
-#define __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H
+#ifndef __EXAMPLES_TESTCASE_SYSTEMIO_ITC_INTERNAL_H
+#define __EXAMPLES_TESTCASE_SYSTEMIO_ITC_INTERNAL_H
 
-#define RETURN_ERR return
+#include "tc_common.h"
 //#define IS_PASS(value) value==1?"PASS":"FAIL"
 
 #define SYSIO_ITC_PRINT   printf
@@ -38,4 +37,4 @@
 **********************************************************/
 char *Expect_Value(int, int);
 
-#endif /* __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H */
+#endif /* __EXAMPLES_TESTCASE_SYSTEMIO_ITC_INTERNAL_H */
diff --git a/apps/examples/testcase/ta_tc/systemio/itc/tc_internal.h b/apps/examples/testcase/ta_tc/systemio/itc/tc_internal.h
deleted file mode 100644 (file)
index 84a2404..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- ****************************************************************************/
-
-/// @file tc_internal.h
-
-/// @brief Header file for System IO TestCase Example
-#ifndef __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H
-#define __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H
-
-#define RETURN_ERR return
-//#define IS_PASS(value) value==1?"PASS":"FAIL"
-
-extern int total_pass;
-extern int total_fail;
-
-#define SYSIO_ITC_PRINT   printf
-#define SYSIO_TC_UART_PRINT   printf
-#define SYSIO_TC_GPIO_PRINT   printf
-#define SYSIO_TC_PWM_PRINT   printf
-#define SYSIO_TC_I2C_PRINT   printf
-
-
-/**********************************************************
-* TC Function Declarations
-**********************************************************/
-char *Expect_Value(int, int);
-
-#endif /* __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H */
index 92731d4..b912332 100644 (file)
 /// @file tc_internal.h
 
 /// @brief Header file for System IO TestCase Example
-#ifndef __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H
-#define __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H
+#ifndef __EXAMPLES_TESTCASE_SYSTEMIO_UTC_INTERNAL_H
+#define __EXAMPLES_TESTCASE_SYSTEMIO_UTC_INTERNAL_H
 
-#define RETURN_ERR return
 //#define IS_PASS(value) value==1?"PASS":"FAIL"
 
 #include "tc_common.h"
@@ -41,4 +40,4 @@ extern int total_fail;
 **********************************************************/
 char *Expect_Value(int, int);
 
-#endif                                                 /* __EXAMPLES_TESTCASE_SYSTEMIO_TC_INTERNAL_H */
+#endif                                                 /* __EXAMPLES_TESTCASE_SYSTEMIO_UTC_INTERNAL_H */
index d9efd97..08a287e 100644 (file)
@@ -73,8 +73,6 @@ static void show_usage(FAR const char *progname)
 
 int sysio_utc(int argc, FAR char *argv[])
 {
-       total_pass = 0;
-       total_fail = 0;
        int cmdtype = 0;
 
        sem_wait(&tc_sem);