From: Krzysztof Jackiewicz Date: Tue, 9 Jun 2015 08:26:25 +0000 (+0200) Subject: CKM: Add asserts for file copying X-Git-Tag: security-manager_5.5_testing~9^2~79 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F40809%2F4;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git CKM: Add asserts for file copying [Problem] If you manually remove contents of /opt/data/ckm/ initial-values tests will fail because the target directory does not exist. [Solution] Add asserts checking if input & output files are correct. [Verification] Remove /otp/data/ckm/initial_values. Run: ckm-tests --group=T60_INITIAL_VALUES. They should fail. Reinstall key-manager run tests again. All should pass. Change-Id: Ib6b7308747b74943ec9d7274284d1d56c9be1641 --- diff --git a/src/ckm/initial-values.cpp b/src/ckm/initial-values.cpp index 197e4391..a66ab6d2 100644 --- a/src/ckm/initial-values.cpp +++ b/src/ckm/initial-values.cpp @@ -92,7 +92,9 @@ std::string format_dest_path(const char *file) void copy_file(const std::string &from, const std::string &to) { std::ifstream infile(from, std::ios_base::binary); + RUNNER_ASSERT_MSG(infile, "Input file " << from << " does not exist."); std::ofstream outfile(to, std::ios_base::binary); + RUNNER_ASSERT_MSG(outfile, "Output file " << to << " does not exist. Reinstall key-manager."); outfile << infile.rdbuf(); }