[integration/efl] Merge eet_identity 33/153933/5
authorse.osadchy <se.osadchy@samsung.com>
Wed, 25 Oct 2017 08:25:57 +0000 (11:25 +0300)
committerArtem Popov <artem.popov@samsung.com>
Wed, 25 Oct 2017 15:26:20 +0000 (18:26 +0300)
Change-Id: I3e43d561b3fb69cab8aa9ab69e09603715741041
Signed-off-by: Artem Popov <artem.popov@samsung.com>
14 files changed:
TC/eet/eet_identity/tslist
TC/eet/eet_identity/tslist_mobile
TC/eet/eet_identity/tslist_tv
TC/eet/eet_identity/tslist_wear
TC/eet/eet_identity/utc_eet_identity.c [new file with mode: 0644]
TC/eet/eet_identity/utc_eet_identity_certificate_print.c [deleted file]
TC/eet/eet_identity/utc_eet_identity_close.c [deleted file]
TC/eet/eet_identity/utc_eet_identity_open.c [deleted file]
TC/eet/eet_identity/utc_eet_identity_print.c [deleted file]
TC/eet/eet_identity/utc_eet_identity_set.c [deleted file]
TC/eet/eet_identity/utc_eet_identity_sha1.c [deleted file]
TC/eet/eet_identity/utc_eet_identity_signature.c [deleted file]
TC/eet/eet_identity/utc_eet_identity_verify.c [deleted file]
TC/eet/eet_identity/utc_eet_identity_x509.c [deleted file]

index c295dcafbe8bfc46d94abdecd09693e48c0ddf71..2c5592927b02785b32d24f23cfa90099103ed35f 100644 (file)
@@ -1,9 +1 @@
-utc_eet_identity_certificate_print.c
-utc_eet_identity_close.c
-utc_eet_identity_open.c
-utc_eet_identity_print.c
-utc_eet_identity_set.c
-utc_eet_identity_sha1.c
-utc_eet_identity_signature.c
-utc_eet_identity_x509.c
-utc_eet_identity_verify.c
+utc_eet_identity.c
index c295dcafbe8bfc46d94abdecd09693e48c0ddf71..2c5592927b02785b32d24f23cfa90099103ed35f 100644 (file)
@@ -1,9 +1 @@
-utc_eet_identity_certificate_print.c
-utc_eet_identity_close.c
-utc_eet_identity_open.c
-utc_eet_identity_print.c
-utc_eet_identity_set.c
-utc_eet_identity_sha1.c
-utc_eet_identity_signature.c
-utc_eet_identity_x509.c
-utc_eet_identity_verify.c
+utc_eet_identity.c
index b016531155c2fe8116417463df9f87a2fe9b0157..2c5592927b02785b32d24f23cfa90099103ed35f 100644 (file)
@@ -1,9 +1 @@
-utc_eet_identity_certificate_print.c
-utc_eet_identity_close.c
-utc_eet_identity_open.c
-utc_eet_identity_print.c
-utc_eet_identity_set.c
-utc_eet_identity_sha1.c
-#utc_eet_identity_signature.c
-utc_eet_identity_x509.c
-#utc_eet_identity_verify.c
+utc_eet_identity.c
index b016531155c2fe8116417463df9f87a2fe9b0157..2c5592927b02785b32d24f23cfa90099103ed35f 100644 (file)
@@ -1,9 +1 @@
-utc_eet_identity_certificate_print.c
-utc_eet_identity_close.c
-utc_eet_identity_open.c
-utc_eet_identity_print.c
-utc_eet_identity_set.c
-utc_eet_identity_sha1.c
-#utc_eet_identity_signature.c
-utc_eet_identity_x509.c
-#utc_eet_identity_verify.c
+utc_eet_identity.c
diff --git a/TC/eet/eet_identity/utc_eet_identity.c b/TC/eet/eet_identity/utc_eet_identity.c
new file mode 100644 (file)
index 0000000..90c7278
--- /dev/null
@@ -0,0 +1,262 @@
+#include <check.h>
+#include <stdio.h>
+#include "../utc_eet_utils.h"
+
+Eet_Key *key;
+const void *certificate;
+FILE *out;
+int size;
+Eet_File *s_ef;
+
+/**
+ * @addtogroup eet
+ * @{
+ * @defgroup eet_identity
+ *
+ *
+ * @precondition
+ * @step 1 eet initialized with eet_init()
+ */
+
+static void
+setup(void)
+{
+   printf(" ============ Startup ============ \n");
+   eet_init();
+}
+
+static void
+teardown(void)
+{
+   printf(" ============ Cleanup ============ \n");
+   eet_shutdown();
+}
+
+/**
+ * @addtogroup eet_identity_open
+ * @{
+ * @defgroup eet_identity_pack_p
+ * @li eet_identity_open()
+ * @li eet_identity_close()
+ * @li eet_identity_certificate_print()
+ * @li eet_identity_set()
+ * @li eet_identity_x509()
+ * @li eet_identity_print()
+ * @li eet_identity_sha1()
+ * @li eet_identity_signature()
+ * @li eet_identity_verify()
+ * @{
+ * @objective Positive test case 01 checking if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Open an eet file on disk, and returns a handle to it.
+ * @step 2 Write data to eet_file.
+ * @step 3 Create an Eet_Key by call eet_identity_open() needed for signing an eet file.
+ * @step 4 Set a key to sign a file by call eet_identity_set() and close file.
+ * @step 5 Open new eet_file.
+ * @step 6 Get the x509 der certificate without size input parameter and check result.
+ * @step 7 Get the x509 der certificate associated with an Eet_File calling eet_identity_x509().
+ * @step 8 Create an empty output file.
+ * @step 9 Try print NULL certificate to file.
+ * @step 10 Call eet_identity_certificate_print() for print certificate to out file.
+ * @step 11 Check result.
+ * @step 12 Call eet_identity_print().
+ * @step 13 Check if eet file with entry is opened.
+ * @step 14 Call eet_identity_sha1().
+ * @step 15 Call eet_identity_signature() two times and check results.
+ * @step 16 Call eet_identity_verify().
+ * @step 17 Call eet_identity_close(), close file, key and clear eet cache.
+ * @step 18 Call Try create Eet_Key with wrong parameters and check result.
+ * @step 19 Close key.
+ *
+ * @passcondition : Test passes if returned values are the same as add values.
+ * @}
+ * @}
+ */
+
+START_TEST(utc_eet_identity_pack_p)
+{
+   long pos;
+   const char *sample = "Sample text to save";
+   Eet_File *ef = utils_eet_create_data_file();
+
+   if (!ef)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   s_ef = eet_open("signed_file.eet", EET_FILE_MODE_WRITE);
+   if (!s_ef)
+     {
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   eet_write(s_ef, "keys/samples", sample, strlen(sample) + 1, 0);
+
+   key = eet_identity_open("cert.pem", "key.pem", NULL);
+   if (key == NULL)
+     {
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   if (eet_identity_set(s_ef, key) != EET_ERROR_NONE)
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   eet_close(s_ef);
+
+   s_ef = eet_open("signed_file.eet", EET_FILE_MODE_READ);
+   if (!s_ef)
+     {
+        eet_identity_close(key);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   if (!eet_identity_x509(s_ef, NULL))
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   certificate = eet_identity_x509(s_ef, &size);
+   if (!certificate || (size <= 0))
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   out = fopen("eet_identity_certificate_print_p_out", "w+");
+   eet_identity_certificate_print(NULL, size, out);
+   eet_identity_certificate_print(certificate, size, out);
+
+   if (ftell(out) <= 0)
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   pos = ftell(out);
+   eet_identity_print(key, out);
+   if (pos == ftell(out))
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   fclose(out);
+   size = 0;
+
+  if (!eet_identity_sha1(s_ef, &size))
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL", __FILE__, __LINE__);
+     }
+   else if (size <= 0)
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. sha1 size is set to 0", __FILE__, __LINE__);
+     }
+   size = 0;
+
+   if (!eet_identity_signature(s_ef, &size))
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
+     }
+   else if (size <= 0)
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set length of signature to %d", __FILE__, __LINE__, size);
+     }
+   size = 0;
+
+   if (eet_identity_signature(ef, &size))
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
+     }
+   else if (size > 0)
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set length of signature to %d", __FILE__, __LINE__, size);
+     }
+
+   if (!eet_identity_verify(s_ef, "cert.pem"))
+     {
+        eet_identity_close(key);
+        eet_close(s_ef);
+        eet_close(ef);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. ", __FILE__, __LINE__);
+     }
+
+   eet_identity_close(key);
+   eet_close(s_ef);
+   eet_close(ef);
+   eet_clearcache();
+
+   key = eet_identity_open("cert.pem", NULL, NULL);
+   if (key != NULL)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   eet_identity_close(key);
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ *@}
+ */
+Suite *
+test_suite(void)
+{
+   Suite *suite = suite_create("utc_eet_identity");
+
+   TCase *tcase = tcase_create("TCase");
+   tcase_set_timeout(tcase, 30);
+   tcase_add_checked_fixture(tcase, setup, teardown);
+   tcase_add_test(tcase, utc_eet_identity_pack_p);
+   suite_add_tcase(suite, tcase);
+
+   return suite;
+}
+
+int
+main()
+{
+   int number_failed;
+
+   Suite *suite = test_suite();
+   SRunner *srunner = srunner_create(suite);
+   srunner_set_log(srunner, "utc_eet_identity.log");
+   srunner_set_xml(srunner, "utc_eet_identity.xml");
+   srunner_run_all(srunner, CK_NORMAL);
+   number_failed = srunner_ntests_failed(srunner);
+   srunner_free(srunner);
+
+   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/TC/eet/eet_identity/utc_eet_identity_certificate_print.c b/TC/eet/eet_identity/utc_eet_identity_certificate_print.c
deleted file mode 100644 (file)
index d5dc31f..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-#include <check.h>
-#include <Eet.h>
-#include <stdio.h>
-
-static const void *certificate;
-static int size;
-static Eet_File *s_ef;
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_certificate_print eet_identity_certificate_print()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- * @step 2 Open an eet file on disk, and returns a handle to it.
- * @step 3 Create an Eet_Key needed for signing an eet file.
- * @step 4 Set a key to sign a file.
- * @step 5 Get the x509 der certificate associated with an Eet_File.
- */
-
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   eet_init();
-
-   const char *sample = "Sample text to save";
-   s_ef = eet_open("signed_file.eet", EET_FILE_MODE_WRITE);
-   eet_write(s_ef, "keys/samples", sample, strlen(sample) + 1, 0);
-   Eet_Key *k = eet_identity_open("cert.pem", "key.pem", NULL);
-   eet_identity_set(s_ef, k);
-   eet_close(s_ef);
-   s_ef = eet_open("signed_file.eet", EET_FILE_MODE_READ);
-   certificate = eet_identity_x509(s_ef, &size);
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   eet_close(s_ef);
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity_certificate_print
- * @{
- * @objective Positive test case 01. Checking if the function prints certificate to out file correctly.
- * @procedure
- * @step 1 Create an empty output file
- * @step 2 Print the x509 der certificate to out file
- * @step 3 Close output file
- *
- * @passcondition : Position indicator value of the out file greater than 0.
- * @}
- */
-START_TEST(utc_eet_identity_certificate_print_p)
-{
-   FILE *out = fopen("eet_identity_certificate_print_p_out", "w+");
-   eet_identity_certificate_print(certificate, size, out);
-
-   if (ftell(out) <= 0)
-     {
-        fclose(out);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-   fclose(out);
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_certificate_print
- * @{
- * @objective Negative test case 01. Incorrect length of certificate passed.
- * @procedure
- * @step 1 Create an empty output file
- * @step 2 Try print the x509 der certificate to out file
- * @step 3 Close output file
- *
- * @passcondition  : Position indicator value of the out file equals to 0.
- * @}
- */
-START_TEST(utc_eet_identity_certificate_print_n)
-{
-   FILE *out = fopen("eet_identity_certificate_print_n_out", "w+");
-   eet_identity_certificate_print(certificate, -1, out);
-
-   if (ftell(out) != 0)
-     {
-        fclose(out);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-   fclose(out);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_certificate_print");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_certificate_print_p);
-   tcase_add_test(tcase, utc_eet_identity_certificate_print_n);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_certificate_print.log");
-   srunner_set_xml(srunner, "utc_eet_identity_certificate_print.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/TC/eet/eet_identity/utc_eet_identity_close.c b/TC/eet/eet_identity/utc_eet_identity_close.c
deleted file mode 100644 (file)
index 814043b..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#include <check.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_close eet_identity_close()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   eet_init();
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity_close
- * @{
- * @objective Positive test case calls function with correct Eet_Key* parameter
- * and checks if it closes given key.
- * @n Input_Data: valid key loaded from files "cert.pem" and "key.pem".
- *
- * @procedure
- * @step 1 Call function eet_identity_open with input files and save returned value.
- * @step 2 Call tested function with pointer to Eet_Key from step 1.
- *
- * @passcondition Memory is freed, function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_identity_close_p)
-{
-   Eet_Key *key = eet_identity_open("cert.pem", "key.pem", NULL);
-
-   if (!key)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Precondition eet_identity_open has failed..", __FILE__, __LINE__);
-     }
-   eet_identity_close(key);
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_close
- * @{
- * @objective Negative test case checks if the function doesn't crash with NULL parameter.
- * @n Input_Data: NULL instead of valid key.
- *
- * @procedure
- * @step 1 Call function eet_identity_open with NULL parameter.
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_identity_close_n)
-{
-
-   UNITEST_FUNC_NEG(eet_identity_close, NULL);
-
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_close");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_close_p);
-   tcase_add_test(tcase, utc_eet_identity_close_n);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_close.log");
-   srunner_set_xml(srunner, "utc_eet_identity_close.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/TC/eet/eet_identity/utc_eet_identity_open.c b/TC/eet/eet_identity/utc_eet_identity_open.c
deleted file mode 100644 (file)
index 864bfa5..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-#include <check.h>
-//#include <Eina.h>
-#include "Eet.h"
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_open eet_identity_open()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   eet_init();
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity_open
- * @{
- * @objective Positive test case 01. Checking if the function returns the key.
- * @procedure
- * @step 1 Initializing a pointer to an Eet_Key with NULL value.
- * @step 2 Calling tested function with with input files.
- *
- * @passcondition  :   If the function returns a value other than NULL then the test is passed, else it is failed.
- * @}
- */
-
-START_TEST(utc_eet_identity_open_p)
-{
-   Eet_Key *key=NULL;
-   key = eet_identity_open("cert.pem", "key.pem", NULL);
-   if (key == NULL)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-      eet_identity_close(key);
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_open
- * @{
- * @objective Negative test case 01. Checking the function for a NULL parameter.
- * @procedure
- * @step 1 Calling tested function with with input files.
- *
- * @passcondition  :   If the function returns a value of NULL then the test is passed, else it is failed.
- * @}
- */
-
-START_TEST(utc_eet_identity_open_n)
-{
-   Eet_Key * key;
-   key = eet_identity_open("cert.pem", NULL, NULL);
-
-   if (key != NULL)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-      eet_identity_close(key);
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_open");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_open_p);
-   tcase_add_test(tcase, utc_eet_identity_open_n);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_open.log");
-   srunner_set_xml(srunner, "utc_eet_identity_open.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/TC/eet/eet_identity/utc_eet_identity_print.c b/TC/eet/eet_identity/utc_eet_identity_print.c
deleted file mode 100644 (file)
index b0ecad6..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#include <check.h>
-#include <Eina.h>
-//#include <Ecore.h>
-#include "Eet.h"
-#include <stdio.h>
-
-static FILE *out;
-static Eet_Key *key;
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_print eet_identity_print()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- * @step 2 creating an output text file
- * @step 3 opening test input files
- */
-
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   eet_init();
-   out = fopen("myfile.txt" , "w+");
-   key = eet_identity_open("cert.pem", "key.pem", NULL);
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   fclose(out);
-   eet_identity_close(key);
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity_print
- * @{
- * @objective Positive test case 01. Checking if the function returns the key.
- * @procedure
- * @step 1 Saving the value of the position indicator of the output file.
- * @step 2 Calling tested function.
- *
- * @passcondition  :   If value of the position indicator differs from one initially saved then the test is passed, else it is failed.
- * @}
- */
-
-START_TEST(utc_eet_identity_print_p)
-{
-   long pos = ftell(out);
-   eet_identity_print(key, out);
-   if (pos == ftell(out))
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_print
- * @{
- * @objective Negative test case 01. Checking the function for a NULL parameter.
- * @procedure
- * @step 1 Saving the value of the position indicator of the output file.
- * @step 2 Calling tested function.
- *
- * @passcondition  :   If value of the position indicator equals to one initially saved then the test is passed, else it is failed.
- * @}
- */
-
-START_TEST(utc_eet_identity_print_n)
-{
-   long pos = ftell(out);
-   eet_identity_print(NULL, out);
-   if(pos != ftell(out))
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_print");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_print_p);
-   tcase_add_test(tcase, utc_eet_identity_print_n);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_print.log");
-   srunner_set_xml(srunner, "utc_eet_identity_print.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/TC/eet/eet_identity/utc_eet_identity_set.c b/TC/eet/eet_identity/utc_eet_identity_set.c
deleted file mode 100644 (file)
index 9783415..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-#include <check.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-static Eet_File *ef = NULL;
-static Eet_Key *key = NULL;
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_set eet_identity_set()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init()
- * @step 2 Open a file
- * @step 3 Open files with key
- */
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   eet_init();
-   ef = eet_open("my_file.eet", EET_FILE_MODE_WRITE);
-   key = eet_identity_open("cert.pem", "key.pem", NULL);
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   eet_identity_close(key);
-   eet_close(ef);
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity_set
- * @{
- * @objective Positive test case checks if invocation of eet_identity_set with
- * correct parameter succeeds.
- * @n Input Data:
- * @li opened empty file;
- * @li crypto key, loaded from files "cert.pem" and "key.pem";
- *
- * @procedure
- * @step 1 Check if empty file and key is opened
- * @step 2 Invoke eet_identity_set with correct parameters
- *
- * @passcondition: Function returns EET_ERROR_NONE.
- * @}
- */
-START_TEST(utc_eet_identity_set_p)
-{
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-   else if (!key)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_Key is NULL..", __FILE__, __LINE__);
-     }
-   else if (eet_identity_set(ef, key) != EET_ERROR_NONE)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-   else
-     {
-        printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-     }
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_set
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns EET_ERROR_NONE value if it is called with NULL instead of crypto key.
- * @n Input Data:
- * @li opened empty file;
- * @li crypto key, loaded from files "cert.pem" and "key.pem";
- *
- * @procedure
- * @step 1 Check if empty file is opened
- * @step 2 Call function once and pass NULL instead of crypto key
- *
- * @passcondition Function doesn't cause segmentation fault and returns EET_ERROR_NONE.
- * @}
- */
-START_TEST(utc_eet_identity_set_n)
-{
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-
-   CREATE_CHECKED_ARGS_ARRAY(0, 1);
-   UNITEST_FUNC_NEG_CA_RET(EET_ERROR_NONE, eet_identity_set, ef, key);
-
-   if (result_of_testing == TEST_FAIL)
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   else
-      printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_set
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns EET_ERROR_BAD_OBJECT value if it is called with NULL instead of opened file.
- * @n Input Data:
- * @li opened empty file;
- * @li crypto key, loaded from files "cert.pem" and "key.pem";
- *
- * @procedure
- * @step 1 Check if key is valid
- * @step 2 Call function once and pass NULL instead of opened file
- *
- * @passcondition Function doesn't cause segmentation fault and returns EET_ERROR_BAD_OBJECT.
- * @}
- */
-START_TEST(utc_eet_identity_set_n2)
-{
-   if (!key)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_Key is NULL..", __FILE__, __LINE__);
-     }
-
-   CREATE_CHECKED_ARGS_ARRAY(1, 0);
-   UNITEST_FUNC_NEG_CA_RET(EET_ERROR_BAD_OBJECT, eet_identity_set, ef, key);
-
-   if (result_of_testing == TEST_FAIL)
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   else
-      printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_set");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_set_p);
-   tcase_add_test(tcase, utc_eet_identity_set_n);
-   tcase_add_test(tcase, utc_eet_identity_set_n2);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_set.log");
-   srunner_set_xml(srunner, "utc_eet_identity_set.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/TC/eet/eet_identity/utc_eet_identity_sha1.c b/TC/eet/eet_identity/utc_eet_identity_sha1.c
deleted file mode 100644 (file)
index 67db926..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-#include <check.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-static Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_sha1 eet_identity_sha1()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- * @step 2 Open a file
- */
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   eet_init();
-   ef = eet_open("file.eet", EET_FILE_MODE_WRITE);
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   eet_close(ef);
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity_sha1
- * @{
- * @objective Positive test case 1 checks if eet_identity_sha1 function gets sha1
- * from unsigned eet file properly.
- * @n Input Data:
- * @li opened eet file;
- * @li pointer to variable to be set with size of sha1.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Invoke eet_identity_sha1
- *
- * @passcondition Function returns SHA1 of the file and set length value greater than 0
- * @}
- */
-START_TEST(utc_eet_identity_sha1_p)
-{
-   int size = 0;
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-   else if (!eet_identity_sha1(ef, &size))
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL", __FILE__, __LINE__);
-     }
-   else if (size <= 0)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. sha1 size is set to 0", __FILE__, __LINE__);
-     }
-   else
-     {
-        printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-     }
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_sha1
- * @{
- * @objective Positive test case 2 checks if function returns valid pointer to sha1
- * if it is called with NULL instead of pointer to variable to be set
- * with sha1 length.
- * @n Input Data:
- * @li opened eet file;
- * @li NULL instead of pointer to variable to be set with length of sha1.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Invoke eet_identity_sha1
- *
- * @passcondition Function returns valid pointer to sha1.
- * @}
- */
-START_TEST(utc_eet_identity_sha1_p2)
-{
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-
-   if (!eet_identity_sha1(ef, NULL))
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_sha1
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL value if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file;
- * @li pointer to variable to be set with size of sha1.
- *
- * @procedure
- * @step 1 Check if eet file with entry is opened
- * @step 2 Call function once and pass NULL instead of opened file
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_identity_sha1_n)
-{
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-   int size;
-
-   CREATE_CHECKED_ARGS_ARRAY(1, 0);
-   UNITEST_FUNC_NEG_CA_RET(NULL, eet_identity_sha1, ef, &size);
-
-   if (result_of_testing == TEST_FAIL)
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   else
-      printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_sha1");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_sha1_p);
-   tcase_add_test(tcase, utc_eet_identity_sha1_p2);
-   tcase_add_test(tcase, utc_eet_identity_sha1_n);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_sha1.log");
-   srunner_set_xml(srunner, "utc_eet_identity_sha1.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/TC/eet/eet_identity/utc_eet_identity_signature.c b/TC/eet/eet_identity/utc_eet_identity_signature.c
deleted file mode 100644 (file)
index 3687d81..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-#include <check.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-static Eet_File* create_eet_file(const char *fname);
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_signature eet_identity_signature()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- */
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   eet_init();
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity_signature
- * @{
- * @objective Auxiliary function Eet_File* create_eet_file(const char *fname).
- * Creates signed eet file with some test data.
- * @procedure
- * @step 1 Open Eet_File file in write mode.
- * @step 2 Write some text buffer into it.
- * @step 3 Create an Eet_Key and sign the file.
- * @step 4 Close the file.
- * @step 5 Clear Eet_Key.
- * @step 6 Open the file in read mode.
- * @param fname - file's name to be created.
- * @return Pointer to opened file or NULL.
- * @}
- */
-static Eet_File* create_eet_file(const char *fname)
-{
-   Eet_File *ef = eet_open(fname, EET_FILE_MODE_WRITE);
-   if (!ef)
-      return NULL;
-
-   if (!eet_write(ef, utc_eet_entry_name, utc_eet_test_string, strlen(utc_eet_test_string) + 1, 0))
-     {
-        printf("[TEST_MSG]:: %s[%d] : Eet error.. Data is not written to Eet_File..\n", __FILE__, __LINE__);
-        eet_close(ef);
-        return NULL;
-     }
-   Eet_Key *key = eet_identity_open("cert.pem", "key.pem", NULL);
-
-   if (key && (eet_identity_set(ef, key) == EET_ERROR_NONE))
-     {
-        eet_close(ef);
-        eet_identity_close(key);
-        return eet_open(fname, EET_FILE_MODE_READ);
-     }
-
-   if (!key)
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Crypto keys are not loaded from disk..", __FILE__, __LINE__);
-   else
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Crypto keys are not set for the file..", __FILE__, __LINE__);
-
-   eet_close(ef);
-   eet_identity_close(key);
-   return NULL;
-}
-
-/**
- * @addtogroup eet_identity_signature
- * @{
- * @objective Positive test case 1 checks if function reads signature from signed eet file properly.
- * @n Input Data:
- * @li opened signed eet file with test data;
- * @li pointer to variable to be set with size of signature from file.
- * .
- * @procedure
- * @step 1 Call create_eet_file to create signed eet file
- * @step 2 Invoke eet_identity_signature
- *
- * @passcondition Function returns raw signature and set length value greater than 0.
- * @}
- */
-START_TEST(utc_eet_identity_signature_p)
-{
-   Eet_File *ef = create_eet_file("signed_file.eet");
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-   int size = 0;
-
-   if (!eet_identity_signature(ef, &size))
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
-     }
-   else if (size <= 0)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set length of signature to %d", __FILE__, __LINE__, size);
-     }
-   else
-     {
-        printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-     }
-   eet_close(ef);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_signature
- * @{
- * @objective Positive test case 2 checks if function return valid pointer to signature
- * if it is called with NULL instead of pointer to variable to be set with signature length.
- * @n Input Data:
- * @li opened signed eet file with test data;
- * @li NULL instead of pointer to variable to be set with size of signature from file.
- *
- * @procedure
- * @step 1 Call create_eet_file to create signed eet file
- * @step 2 Invoke eet_identity_signature
- *
- * @passcondition Function and returns valid pointer to signature.
- * @}
- */
-START_TEST(utc_eet_identity_signature_p2)
-{
-   Eet_File *ef = create_eet_file("signed_file.eet");
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-
-   if (!eet_identity_signature(ef, NULL))
-     {
-        eet_close(ef);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-   eet_close(ef);
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_signature
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with unsigned file.
- * @n Input Data:
- * @li opened unsigned eet file with test data;
- * @li pointer to variable to be set with size of signature from file.
- *
- * @procedure
- * @step 1 Call utils_eet_create_data_file to create unsigned eet file
- * @step 2 Invoke eet_identity_signature
- *
- * @passcondition Function doesn't cause segmentation fault, returns NULL and doesn't set length of signature.
- * @}
- */
-START_TEST(utc_eet_identity_signature_n)
-{
-   Eet_File *ef = utils_eet_create_data_file();
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-
-   eet_close(ef);
-   int size = 0;
-
-   if (eet_identity_signature(ef, &size))
-     {
-        eet_close(ef);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned not NULL..", __FILE__, __LINE__);
-     }
-   else if (size > 0)
-     {
-        eet_close(ef);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set length of signature to %d",
-        __FILE__, __LINE__, size);
-     }
-   else
-     {
-        eet_close(ef);
-        printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-     }
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_signature
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns NULL value if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened signed eet file with test data;
- * @li pointer to variable to be set with size of signature from file.
- *
- * @procedure
- * @step 1 Call create_eet_file to create signed eet file
- * @step 2 Call function once and pass NULL instead of opened signed file
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_identity_signature_n2)
-{
-   Eet_File *ef = create_eet_file("signed_file.eet");
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-   int size;
-
-   CREATE_CHECKED_ARGS_ARRAY(1, 0);
-   UNITEST_FUNC_NEG_CA_RET(NULL, eet_identity_signature, ef, &size);
-
-   if (result_of_testing == TEST_FAIL)
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   else
-      printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_signature");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_signature_p);
-   tcase_add_test(tcase, utc_eet_identity_signature_p2);
-   tcase_add_test(tcase, utc_eet_identity_signature_n);
-   tcase_add_test(tcase, utc_eet_identity_signature_n2);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_signature.log");
-   srunner_set_xml(srunner, "utc_eet_identity_signature.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/TC/eet/eet_identity/utc_eet_identity_verify.c b/TC/eet/eet_identity/utc_eet_identity_verify.c
deleted file mode 100644 (file)
index b232dc7..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#include <check.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "Eet.h"
-
-/**
- * @addtogroup eet
- * @{
- * @defgroup eet_identity
- *
- *
- * @precondition
- * @step 1 Initialize Eet library.
- */
-
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   if (eet_init() < 1)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_verify
- * eet_identity_open()
- * eet_identity_set()
- * eet_identity_print()
- * eet_identity_verify()
- * eet_identity_x509()
- * eet_identity_certificate_print()
- *
- * @{
- * @objective Test eet_identity_verify
- * @n Input Data:
- * @li Test file: file with name generated from template "/tmp/eet_suite_testXXXXXX"
- * @li Test data: "Here is a string of data to save !"
- * @li Test file section: "keys/tests"
- * @li Certificate and Key files.
- *
- * @procedure
- * @step 1 Create test file. Check that file can be open correctly.
- * @step 2 Open an eet file on disk, and check handle of it.
- * @step 3 Write test data into test file.
- * @step 4 Create an Eet_Key needed for signing an eet file. Check that key created successfully.
- * @step 5 Set Eet_Key to test file as identity key.
- * @step 6 Display both private and public key of an Eet_Key.
- * @step 7 Close an eet file handle and flush pending writes.
- * @step 8 Open an eet file on disk, and check handle of it.
- * @step 9 Check that certificates match.
- * @step 10 Read a test file entry from and check returned data.
- * @step 11 Get the x509 der certificate associated with an Eet_File.
- * @step 12 Check that certificate exists.
- * @step 13 Close an eet file handle and flush pending writes.
- * @step 14 Clear eet cache.
- * @step 15 Delete file.
- *
- * @passcondition
- * All checks passed and no segmentation fault.
- * @}
- * @}
- */
-START_TEST(utc_eet_identity_verify_test)
-{
-   const char *buffer = "Here is a string of data to save !";
-   const void *tmp;
-   Eet_File *ef;
-   Eet_Key *k;
-   FILE *noread;
-   char *test;
-   char *file;
-   int size;
-   int fd;
-
-   file = strdup("/tmp/eet_suite_testXXXXXX");
-
-   if (-1 == (fd = mkstemp(file)))
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   if (!!close(fd))
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   if (!(noread = fopen("/dev/null", "wb")))
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   /* Sign an eet file. */
-   ef = eet_open(file, EET_FILE_MODE_WRITE);
-   if (!ef)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   if (!eet_write(ef, "keys/tests", buffer, strlen(buffer) + 1, 0))
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   k = eet_identity_open("cert.pem", "key.pem", NULL);
-   if (!k)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   if (eet_identity_set(ef, k) != EET_ERROR_NONE)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   eet_identity_print(k, noread);
-
-   eet_close(ef);
-
-   /* Open a signed file. */
-   ef = eet_open(file, EET_FILE_MODE_READ);
-   if (!ef)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   /* check that the certificates match */
-   if (!eet_identity_verify(ef, "cert.pem"))
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   test = eet_read(ef, "keys/tests", &size);
-   if (!test)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   if (size != (int)strlen(buffer) + 1)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   if (memcmp(test, buffer, strlen(buffer) + 1) != 0)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   tmp = eet_identity_x509(ef, &size);
-   if (tmp == NULL)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   eet_identity_certificate_print(tmp, size, noread);
-
-   eet_close(ef);
-
-   /* As we are changing file contain in less than 1s, this could get unnoticed
-      by eet cache system. */
-   eet_clearcache();
-
-   if (unlink(file) != 0)
-     ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_verify");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_verify_test);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_verify.log");
-   srunner_set_xml(srunner, "utc_eet_identity_verify.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/TC/eet/eet_identity/utc_eet_identity_x509.c b/TC/eet/eet_identity/utc_eet_identity_x509.c
deleted file mode 100644 (file)
index f567110..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-#include <check.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-static Eet_File* create_eet_file(const char *fname);
-
-/**
- * @addtogroup eet_identity
- * @{
- * @defgroup eet_identity_x509 eet_identity_x509()
- *
- *
- * @precondition
- * @step 1 Initialize with eet_init().
- */
-static void
-setup(void)
-{
-   printf(" ============ Startup ============ \n");
-   eet_init();
-}
-
-static void
-teardown(void)
-{
-   printf(" ============ Cleanup ============ \n");
-   eet_shutdown();
-}
-
-/**
- * @addtogroup eet_identity_x509
- * @{
- * @objective Auxiliary function Eet_File* create_eet_file(const char *fname).
- * Creates signed eet file with some test data.
- * @procedure
- * @step 1 Open Eet_File file in write mode.
- * @step 2 Write some text buffer into it.
- * @step 3 Create an Eet_Key and sign the file.
- * @step 4 Close the file.
- * @step 5 Clear Eet_Key.
- * @step 6 Open the file in read mode.
- * @param fname - file's name to be created.
- * @return Pointer to opened file or NULL.
- * @}
- */
-static Eet_File* create_eet_file(const char *fname)
-{
-   Eet_File *ef = eet_open(fname, EET_FILE_MODE_WRITE);
-   if (!ef)
-      return NULL;
-
-   if (!eet_write(ef, utc_eet_entry_name, utc_eet_test_string, strlen(utc_eet_test_string) + 1, 0))
-     {
-        printf("[TEST_MSG]:: %s[%d] : Eet error.. Data is not written to Eet_File..\n", __FILE__, __LINE__);
-        eet_close(ef);
-        return NULL;
-     }
-   Eet_Key *key = eet_identity_open("cert.pem", "key.pem", NULL);
-
-   if (key && (eet_identity_set(ef, key) == EET_ERROR_NONE))
-     {
-        eet_close(ef);
-        eet_identity_close(key);
-        return eet_open(fname, EET_FILE_MODE_READ);
-     }
-
-   if (!key)
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Crypto keys are not loaded from disk..", __FILE__, __LINE__);
-   else
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Crypto keys are not set for the file..", __FILE__, __LINE__);
-
-   eet_close(ef);
-   eet_identity_close(key);
-   return NULL;
-}
-
-/**
- * @addtogroup eet_identity_x509
- * @{
- * @objective Positive test case 1 checks if function reads x509 certificate from signed eet file properly.
- * @n Input Data:
- * @li opened signed eet file with test data;
- * @li pointer to variable to be set with size of x509 certificate from file.
- * .
- * @procedure
- * @step 1 Call create_eet_file to create signed eet file
- * @step 2 Invoke eet_identity_x509
- *
- * @passcondition Function returns x509 certificate and set length value greater than 0.
- * @}
- */
-START_TEST(utc_eet_identity_x509_p)
-{
-   Eet_File *ef = create_eet_file("signed_file.eet");
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-   int size = 0;
-
-   if (!eet_identity_x509(ef, &size))
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned NULL..", __FILE__, __LINE__);
-     }
-   else if (size <= 0)
-     {
-   ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set length of certificate to %d", __FILE__, __LINE__, size);
-     }
-   else
-     {
-        printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-     }
-   eet_close(ef);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_x509
- * @{
- * @objective Positive test case 2 checks if function returns valid pointer to certificate
- * if it is called with NULL instead of pointer to variable to be set with x509 certificate length.
- * @n Input Data:
- * @li opened signed eet file with test data;
- * @li NULL instead of pointer to variable to be set with size of certificate from file.
- *
- * @procedure
- * @step 1 Call create_eet_file to create signed eet file
- * @step 2 Invoke eet_identity_x509
- *
- * @passcondition Function returns valid pointer to certificate.
- * @}
- */
-START_TEST(utc_eet_identity_x509_p2)
-{
-   Eet_File *ef = create_eet_file("signed_file.eet");
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-
-   if (!eet_identity_x509(ef, NULL))
-     {
-        eet_close(ef);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
-   eet_close(ef);
-   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_x509
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with unsigned file.
- * @n Input Data:
- * @li opened unsigned eet file with test data;
- * @li pointer to variable to be set with size of x509 certificate from file.
- *
- * @procedure
- * @step 1 Call utils_eet_create_data_file to create unsigned eet file
- * @step 2 Invoke eet_identity_x509
- *
- * @passcondition Function doesn't cause segmentation fault, returns NULL and
- * doesn't set length of certificate.
- * @}
- */
-START_TEST(utc_eet_identity_x509_n)
-{
-   Eet_File *ef = utils_eet_create_data_file();
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-
-   eet_close(ef);
-   int size = 0;
-
-   if (eet_identity_x509(ef, &size))
-     {
-        eet_close(ef);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function returned not NULL..", __FILE__, __LINE__);
-     }
-   else if (size > 0)
-     {
-        eet_close(ef);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function set length of certificate to %d", __FILE__, __LINE__, size);
-     }
-   else
-     {
-        eet_close(ef);
-        printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-     }
-}
-END_TEST
-
-/**
- * @addtogroup eet_identity_x509
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns NULL value if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened signed eet file with test data;
- * @li pointer to variable to be set with size of certificate from file.
- *
- * @procedure
- * @step 1 Call create_eet_file to create signed eet file
- * @step 2 Call function once and pass NULL instead of opened signed file
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_identity_x509_n2)
-{
-   Eet_File *ef = create_eet_file("signed_file.eet");
-
-   if (!ef)
-     {
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is NULL..", __FILE__, __LINE__);
-     }
-   int size;
-
-   CREATE_CHECKED_ARGS_ARRAY(1, 0);
-   UNITEST_FUNC_NEG_CA_RET(NULL, eet_identity_x509, ef, &size);
-
-   if (result_of_testing == TEST_FAIL)
-      ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-   else
-      printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
-   Suite *suite = suite_create("utc_eet_identity_x509");
-
-   TCase *tcase = tcase_create("TCase");
-   tcase_set_timeout(tcase, 30);
-   tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_eet_identity_x509_p);
-   tcase_add_test(tcase, utc_eet_identity_x509_p2);
-   tcase_add_test(tcase, utc_eet_identity_x509_n);
-   tcase_add_test(tcase, utc_eet_identity_x509_n2);
-   suite_add_tcase(suite, tcase);
-
-   return suite;
-}
-
-int
-main()
-{
-   int number_failed;
-
-   Suite *suite = test_suite();
-   SRunner *srunner = srunner_create(suite);
-   srunner_set_log(srunner, "utc_eet_identity_x509.log");
-   srunner_set_xml(srunner, "utc_eet_identity_x509.xml");
-   srunner_run_all(srunner, CK_NORMAL);
-   number_failed = srunner_ntests_failed(srunner);
-   srunner_free(srunner);
-
-   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}