Include error-header to API header explicitly 69/138369/1
authorsangwan.kwon <sangwan.kwon@samsung.com>
Wed, 12 Jul 2017 02:50:40 +0000 (11:50 +0900)
committersangwan.kwon <sangwan.kwon@samsung.com>
Wed, 12 Jul 2017 03:07:13 +0000 (12:07 +0900)
Change-Id: I7424d6d664200d88876453e16ecb8370f71b8dee
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
api/tanchor/trust-anchor.h
api/tanchor/trust-anchor.hxx
examples/installer.c
examples/launcher.c
tests/test-capi-installer.cpp
tests/test-capi-launcher.cpp
tests/test-curl.cpp
tests/test-installer.cpp
tests/test-launcher.cpp

index 3b1f78d..3a7f123 100644 (file)
@@ -29,6 +29,8 @@
 #include <stdbool.h>
 #include <sys/types.h>
 
+#include <tanchor/error.h>
+
 
 #ifdef __cplusplus
 extern "C" {
index f3596ad..a26350f 100644 (file)
@@ -28,6 +28,8 @@
 #include <string>
 #include <memory>
 
+#include <tanchor/error.h>
+
 
 #define TANCHOR_API __attribute__((visibility("default")))
 
index 45100f5..6b944e0 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 #include <tanchor/trust-anchor.h>
-#include <tanchor/error.h>
 
 #include <stdio.h>
 
index 7aa2016..33f5110 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 #include <tanchor/trust-anchor.h>
-#include <tanchor/error.h>
 
 #include <stdio.h>
 
index d425886..6390cae 100644 (file)
 TESTCASE(CAPI_TRUST_ANCHOR_INSTALL_GLOBAL_APP_POSITIVE)
 {
        int ret = trust_anchor_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_INSTALL_GLOBAL_APP_WITH_SYS_POSITIVE)
 {
        int ret = trust_anchor_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, true);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_INSTALL_USER_APP_POSITIVE)
 {
        int ret = trust_anchor_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_INSTALL_USER_APP_WITH_SYS_POSITIVE)
 {
        int ret = trust_anchor_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, true);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_INSTALL_GLOBAL_APP_NEGATIVE)
 {
        int ret = trust_anchor_global_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, false);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_INSTALL_GLOBAL_APP_WITH_SYS_NEGATIVE)
 {
        int ret = trust_anchor_global_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, true);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_INSTALL_USER_APP_NEGATIVE)
 {
        int ret = trust_anchor_usr_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID, false);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_INSTALL_USER_APP_WITH_SYS_NEGATIVE)
 {
        int ret = trust_anchor_usr_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID, true);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_UNINSTALL_GLOBAL_APP_POSITIVE)
 {
        int ret = trust_anchor_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
        ret = trust_anchor_global_uninstall(DUMMY_PKG_ID, APP_CERTS_DIR);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_UNINSTALL_USER_APP_POSITIVE)
 {
        int ret = trust_anchor_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
        ret = trust_anchor_usr_uninstall(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_UNINSTALL_GLOBAL_APP_NEGATIVE)
 {
        int ret = trust_anchor_global_uninstall(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(CAPI_TRUST_ANCHOR_UNINSTALL_USER_APP_NEGATIVE)
 {
        int ret = trust_anchor_usr_uninstall(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
index 2be8c15..942b0e3 100644 (file)
@@ -42,7 +42,7 @@ TESTCASE(CAPI_TRUST_ANCHOR_LAUNCH)
 
        if (pid == 0) {
                ret = trust_anchor_global_launch(DUMMY_PKG_ID, APP_CERTS_DIR);
-               TEST_EXPECT(true, ret == 0);
+               TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
                auto afterLsChild = test::util::ls(TZ_SYS_RO_CA_CERTS);
                TEST_EXPECT(true, beforeLs != afterLsChild);
index 6586aa7..6635edd 100644 (file)
@@ -44,7 +44,7 @@ TESTCASE(TRUST_ANCHOR_LAUNCH)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
        int ret = ta.install(false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
        std::cout << "##########################################" << std::endl;
        std::cout << "## Before trust-anchor launch#############" << std::endl;
@@ -58,7 +58,7 @@ TESTCASE(TRUST_ANCHOR_LAUNCH)
 
        if (pid == 0) {
                ret = ta.launch();
-               TEST_EXPECT(true, ret == 0);
+               TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
                // check SSL communication
                std::cout << "##########################################" << std::endl;
@@ -81,7 +81,7 @@ TESTCASE(TRUST_ANCHOR_LAUNCH_WITH_SYS)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
        int ret = ta.install(true);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
        std::cout << "##########################################" << std::endl;
        std::cout << "## Before trust-anchor launch#############" << std::endl;
@@ -95,7 +95,7 @@ TESTCASE(TRUST_ANCHOR_LAUNCH_WITH_SYS)
 
        if (pid == 0) {
                ret = ta.launch();
-               TEST_EXPECT(true, ret == 0);
+               TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
                // check SSL communication
                std::cout << "###########################################" << std::endl;
index 3a21ddc..15d827c 100644 (file)
@@ -37,7 +37,7 @@ TESTCASE(TRUST_ANCHOR_INSTALL_GLOBAL_APP_POSITIVE)
        TIME_MEASURE_START
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
        int ret = ta.install(false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
        TIME_MEASURE_END
 }
 
@@ -46,7 +46,7 @@ TESTCASE(TRUST_ANCHOR_INSTALL_GLOBAL_APP_WITH_SYS_POSITIVE)
        TIME_MEASURE_START
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
        int ret = ta.install(true);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
        TIME_MEASURE_END
 }
 
@@ -54,74 +54,74 @@ TESTCASE(TRUST_ANCHOR_INSTALL_USER_APP_POSITIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
        int ret = ta.install(false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_INSTALL_USER_APP_WITH_SYS_POSITIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
        int ret = ta.install(true);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_INSTALL_GLOBAL_APP_NEGATIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
        int ret = ta.install(false);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_INSTALL_GLOBAL_APP_WITH_SYS_NEGATIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
        int ret = ta.install(true);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_INSTALL_USER_APP_NEGATIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
        int ret = ta.install(false);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_INSTALL_USER_APP_WITH_SYS_NEGATIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
        int ret = ta.install(true);
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_UNINSTALL_GLOBAL_APP_POSITIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
        int ret = ta.install(false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
        ret = ta.uninstall();
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_UNINSTALL_USER_APP_POSITIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
        int ret = ta.install(false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
        ret = ta.uninstall();
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_UNINSTALL_GLOBAL_APP_NEGATIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
        int ret = ta.uninstall();
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
 
 TESTCASE(TRUST_ANCHOR_UNINSTALL_USER_APP_NEGATIVE)
 {
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
        int ret = ta.uninstall();
-       TEST_EXPECT(false, ret == 0);
+       TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE);
 }
index 9920751..0db5d21 100644 (file)
@@ -39,7 +39,7 @@ TESTCASE(TRUST_ANCHOR_LAUNCH)
 
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
        int ret = ta.install(false);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
        // pre-condition
        int pid = fork();
@@ -49,7 +49,7 @@ TESTCASE(TRUST_ANCHOR_LAUNCH)
                TIME_MEASURE_START
                ret = ta.launch();
                TIME_MEASURE_END
-               TEST_EXPECT(true, ret == 0);
+               TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
                // check file-system
                auto afterLsChild = test::util::ls(TZ_SYS_RO_CA_CERTS);
@@ -75,7 +75,7 @@ TESTCASE(TRUST_ANCHOR_LAUNCH_WITH_SYS)
 
        tanchor::TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
        int ret = ta.install(true);
-       TEST_EXPECT(true, ret == 0);
+       TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
        // pre-condition
        int pid = fork();
@@ -85,7 +85,7 @@ TESTCASE(TRUST_ANCHOR_LAUNCH_WITH_SYS)
                TIME_MEASURE_START
                ret = ta.launch();
                TIME_MEASURE_END
-               TEST_EXPECT(true, ret == 0);
+               TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE);
 
                // check file-system
                auto afterLsChild = test::util::ls(TZ_SYS_RO_CA_CERTS);