From 36472df6c4f1235df68b2d0d82057fff6987ea2a Mon Sep 17 00:00:00 2001 From: Pawel Kowalski Date: Mon, 4 Dec 2017 11:50:24 +0100 Subject: [PATCH] Initial commit for the ODE API unit tests Change-Id: I57188a5c866e96e20a230966f5202d68d00e9cb0 --- CMakeLists.txt | 1 + README | 2 ++ packaging/security-tests.spec | 2 ++ src/CMakeLists.txt | 4 ++++ src/ode/CMakeLists.txt | 38 +++++++++++++++++++++++++++++++ src/ode/ode-tests-external-encryption.cpp | 23 +++++++++++++++++++ src/ode/ode-tests-internal-encryption.cpp | 23 +++++++++++++++++++ src/ode/ode-tests-keys.cpp | 23 +++++++++++++++++++ src/ode/ode-tests-luks.cpp | 23 +++++++++++++++++++ src/ode/ode-tests-secure-erase.cpp | 23 +++++++++++++++++++ src/ode/ode-tests.cpp | 27 ++++++++++++++++++++++ 11 files changed, 189 insertions(+) create mode 100644 src/ode/CMakeLists.txt create mode 100644 src/ode/ode-tests-external-encryption.cpp create mode 100644 src/ode/ode-tests-internal-encryption.cpp create mode 100644 src/ode/ode-tests-keys.cpp create mode 100644 src/ode/ode-tests-luks.cpp create mode 100644 src/ode/ode-tests-secure-erase.cpp create mode 100644 src/ode/ode-tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index a89c09c..93498f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ IF(BUILD_ALL_TESTS) SET(BUILD_CYNARA ON) SET(BUILD_WEB ON) SET(BUILD_YACA ON) + SET(BUILD_ODE ON) ENDIF(BUILD_ALL_TESTS) # If supported for the target machine, emit position-independent code,suitable diff --git a/README b/README index c94a739..ea2b291 100644 --- a/README +++ b/README @@ -15,6 +15,8 @@ security-manager security-manager-tests cynara cynara-test +ode + ode-tests There are also inner-tests for testing complex security-tests framework mechanisms with binary: diff --git a/packaging/security-tests.spec b/packaging/security-tests.spec index 709a3e6..80ab147 100644 --- a/packaging/security-tests.spec +++ b/packaging/security-tests.spec @@ -14,6 +14,7 @@ BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(security-manager) BuildRequires: pkgconfig(key-manager) BuildRequires: pkgconfig(yaca) +BuildRequires: pkgconfig(ode) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(dbus-1) @@ -100,6 +101,7 @@ echo "security-tests postinst done ..." /usr/bin/ckm-tests /usr/bin/ckm-integration-tests /usr/bin/yaca-test +/usr/bin/ode-tests %{ckm_test_dir}/* /etc/security-tests /usr/lib/security-tests/cynara-tests/plugins/single-policy/* diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 471c28e..93c862c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -110,3 +110,7 @@ ENDIF(BUILD_WEB) IF(BUILD_YACA) ADD_SUBDIRECTORY(yaca) ENDIF(BUILD_YACA) + +IF(BUILD_ODE) + ADD_SUBDIRECTORY(ode) +ENDIF(BUILD_ODE) \ No newline at end of file diff --git a/src/ode/CMakeLists.txt b/src/ode/CMakeLists.txt new file mode 100644 index 0000000..f5d8c41 --- /dev/null +++ b/src/ode/CMakeLists.txt @@ -0,0 +1,38 @@ +# +# Copyright (c) 2017 Samsung Electronics Co., Ltd 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 CMakeLists.txt +# @author Pawel Kowalski (p.kowalski2@partner.samsung.com) +# + +MESSAGE(STATUS "") +MESSAGE(STATUS "Generating makefile for the ODE tests...") + +FILE(GLOB ode_tests_SRCS *.cpp) + +## Setup target ################################################################ +SET(ODE_TESTS "ode-tests") +ADD_EXECUTABLE(${ODE_TESTS} ${ode_tests_SRCS}) + +## Link libraries ############################################################## +PKG_CHECK_MODULES(ODE_TESTS_DEPS REQUIRED ode) + +INCLUDE_DIRECTORIES(SYSTEM ${ODE_TESTS_DEPS_INCLUDE_DIRS}) +TARGET_LINK_LIBRARIES(${ODE_TESTS} + ${ODE_TESTS_DEPS_LIBRARIES} + dpl-test-framework) + +## Install ##################################################################### +INSTALL(TARGETS ${ODE_TESTS} DESTINATION bin) \ No newline at end of file diff --git a/src/ode/ode-tests-external-encryption.cpp b/src/ode/ode-tests-external-encryption.cpp new file mode 100644 index 0000000..27289d9 --- /dev/null +++ b/src/ode/ode-tests-external-encryption.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd 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 ode-tests-external-encryption.cpp + * @author Pawel Kowalski (p.kowalski2@partner.samsung.com) + * @brief Tests for testing the ODE API + */ + +#include "dpl/test/test_runner.h" + +RUNNER_TEST_GROUP_INIT(T0000_ODE_API_EXTERNAL_ENCRYPTION); \ No newline at end of file diff --git a/src/ode/ode-tests-internal-encryption.cpp b/src/ode/ode-tests-internal-encryption.cpp new file mode 100644 index 0000000..6ae34d2 --- /dev/null +++ b/src/ode/ode-tests-internal-encryption.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd 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 ode-tests-internal-encryption.cpp + * @author Pawel Kowalski (p.kowalski2@partner.samsung.com) + * @brief Tests for testing the ODE API + */ + +#include "dpl/test/test_runner.h" + +RUNNER_TEST_GROUP_INIT(T1000_ODE_API_INTERNAL_ENCRYPTION); \ No newline at end of file diff --git a/src/ode/ode-tests-keys.cpp b/src/ode/ode-tests-keys.cpp new file mode 100644 index 0000000..c75aee7 --- /dev/null +++ b/src/ode/ode-tests-keys.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd 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 ode-tests-keys.cpp + * @author Pawel Kowalski (p.kowalski2@partner.samsung.com) + * @brief Tests for testing the ODE API + */ + +#include "dpl/test/test_runner.h" + +RUNNER_TEST_GROUP_INIT(T2000_ODE_API_KEYS); \ No newline at end of file diff --git a/src/ode/ode-tests-luks.cpp b/src/ode/ode-tests-luks.cpp new file mode 100644 index 0000000..5ae2cb4 --- /dev/null +++ b/src/ode/ode-tests-luks.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd 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 ode-tests-luks.cpp + * @author Pawel Kowalski (p.kowalski2@partner.samsung.com) + * @brief Tests for testing the ODE API + */ + +#include "dpl/test/test_runner.h" + +RUNNER_TEST_GROUP_INIT(T3000_ODE_API_LUKS); \ No newline at end of file diff --git a/src/ode/ode-tests-secure-erase.cpp b/src/ode/ode-tests-secure-erase.cpp new file mode 100644 index 0000000..c59f909 --- /dev/null +++ b/src/ode/ode-tests-secure-erase.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd 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 ode-tests-secure-erase.cpp + * @author Pawel Kowalski (p.kowalski2@partner.samsung.com) + * @brief Tests for testing the ODE API + */ + +#include "dpl/test/test_runner.h" + +RUNNER_TEST_GROUP_INIT(T4000_ODE_API_SECURE_ERASE); \ No newline at end of file diff --git a/src/ode/ode-tests.cpp b/src/ode/ode-tests.cpp new file mode 100644 index 0000000..4276838 --- /dev/null +++ b/src/ode/ode-tests.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd 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 ode-test.cpp + * @author Pawel Kowalski (p.kowalski2@partner.samsung.com) + * @brief Tests for testing the ODE API + */ + +#include "dpl/test/test_runner.h" + +int main (int argc, char *argv[]) +{ + int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv); + return status; +} \ No newline at end of file -- 2.7.4