/* * Copyright (c) 2022-2023 Huawei Device 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 "b_process/b_process.h" #include "test_manager.h" #include "gtest/gtest.h" namespace OHOS::FileManagement::Backup { class ToolsTest : public testing::Test { public: static void SetUpTestCase(void) {}; static void TearDownTestCase() {}; void SetUp() {}; void TearDown() {}; }; /** * @tc.number: SUB_backup_tool_help_0100 * @tc.name: tool_help_0100 * @tc.desc: 测试help命令常规用法 * @tc.size: MEDIUM * @tc.type: FUNC * @tc.level Level 0 * @tc.require: I6F3GV */ HWTEST_F(ToolsTest, tool_help_0100, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "ToolsTest-begin tool_help_0100"; try { auto [bFatalError, ret] = BProcess::ExecuteCmd({ "/system/bin/backup_tool", "help", }); EXPECT_EQ(ret, 0); } catch (...) { EXPECT_TRUE(false); GTEST_LOG_(INFO) << "ToolsTest-an exception occurred."; } GTEST_LOG_(INFO) << "ToolsTest-end tool_help_0100"; } /** * @tc.number: SUB_backup_tool_help_0200 * @tc.name: tool_help_0200 * @tc.desc: 测试help命令错误使用 * @tc.size: MEDIUM * @tc.type: FUNC * @tc.level Level 0 * @tc.require: I6F3GV */ HWTEST_F(ToolsTest, tool_help_0200, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "ToolsTest-begin tool_help_0200"; try { auto [bFatalError, ret] = BProcess::ExecuteCmd({ "/system/bin/backup_tool", "xxxx", }); EXPECT_NE(ret, 0); } catch (...) { EXPECT_TRUE(false); GTEST_LOG_(INFO) << "ToolsTest-an exception occurred."; } GTEST_LOG_(INFO) << "ToolsTest-end tool_help_0200"; } } // namespace OHOS::FileManagement::Backup