%check
export LD_LIBRARY_PATH=../../client
-##ctest -V
+ctest -V
%fdupes %{buildroot}
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include "mock/unistd_mock.hh"
+#include "mock/mock_hook.hh"
+#include "mock/test_fixture.hh"
+
+extern "C" int access(const char* pathname, int mode) {
+ return MOCK_HOOK_P2(UnistdMock, access, pathname, mode);
+}
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#ifndef UNIT_TESTS_MOCK_UNISTD_MOCK_HH_
+#define UNIT_TESTS_MOCK_UNISTD_MOCK_HH_
+
+#include <gmock/gmock.h>
+#include <unistd.h>
+
+#include "mock/module_mock.hh"
+
+class UnistdMock : public virtual ModuleMock {
+ public:
+ UnistdMock() {
+ using ::testing::_;
+ using ::testing::Return;
+ using ::testing::Invoke;
+
+ ON_CALL(*this, access(_, _))
+ .WillByDefault(Return(0));
+ }
+
+ MOCK_METHOD2(access, int (const char*, int));
+
+ private:
+ static int dummy_;
+};
+
+#endif // UNIT_TESTS_MOCK_UNISTD_MOCK_HH_
+
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "unit_tests/mock/rpc_port_mock.hh"
#include "unit_tests/mock/app_event_mock.hh"
+#include "unit_tests/mock/rpc_port_mock.hh"
#include "unit_tests/mock/test_fixture.hh"
+#include "unit_tests/mock/unistd_mock.hh"
using ::testing::_;
using ::testing::Invoke;
namespace {
class Mocks : public ::testing::NiceMock<RpcPortMock>,
- virtual public ::testing::NiceMock<AppEventMock> {};
+ virtual public ::testing::NiceMock<AppEventMock>,
+ virtual public ::testing::NiceMock<UnistdMock> {};
} // namespace
int ret = pkgmgr_client_get_package_size_info(GetHandle(), "org.tizen.test",
GetDefaultPkgSizeHandler(), nullptr);
- EXPECT_TRUE(ret > 0);
+ EXPECT_EQ(ret, PKGMGR_R_OK);
}
TEST_F(ClientTest, pkgmgr_client_get_package_size_info_n) {