Android-cuttlefish cvd tool
creation_analyzer_helper.h
Go to the documentation of this file.
1//
2// Copyright (C) 2022 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#pragma once
17
18#include <sys/types.h>
19#include <unistd.h>
20
21#include <string>
22#include <unordered_map>
23#include <vector>
24
25#include <gtest/gtest.h>
26
28
29namespace cuttlefish {
30namespace selector {
31
32struct OutputInfo {
33 std::string home;
34 std::string host_artifacts_path;
35 std::string group_name;
36 std::vector<unsigned> instances;
37 std::vector<std::string> args;
38 std::unordered_map<std::string, std::string> envs;
39};
40
41struct Expected {
44};
45
47 // inputs
48 std::string selector_args;
49 std::string cmd_args;
50 std::string home;
51 std::string android_host_out;
52
53 // output
55};
56
57class CreationInfoGenTest : public testing::TestWithParam<InputOutput> {
58 protected:
60 void Init();
61
62 std::vector<std::string> selector_args_;
63 std::string sub_cmd_;
64 std::vector<std::string> cmd_args_;
65 std::unordered_map<std::string, std::string> envs_;
69};
70
71class HomeTest : public CreationInfoGenTest {};
75
76} // namespace selector
77} // namespace cuttlefish
Definition: instance_lock.h:45
Definition: creation_analyzer_helper.h:57
CreationInfoGenTest()
Definition: creation_analyzer_helper.cpp:50
std::vector< std::string > selector_args_
Definition: creation_analyzer_helper.h:62
std::vector< std::string > cmd_args_
Definition: creation_analyzer_helper.h:64
std::string sub_cmd_
Definition: creation_analyzer_helper.h:63
void Init()
Definition: creation_analyzer_helper.cpp:51
bool expected_success_
Definition: creation_analyzer_helper.h:67
OutputInfo expected_output_
Definition: creation_analyzer_helper.h:66
std::unordered_map< std::string, std::string > envs_
Definition: creation_analyzer_helper.h:65
InstanceLockFileManager instance_lock_file_manager_
Definition: creation_analyzer_helper.h:68
Definition: creation_analyzer_helper.h:71
Definition: creation_analyzer_helper.h:72
Definition: creation_analyzer_helper.h:73
Definition: creation_analyzer_helper.h:74
Definition: alloc_utils.cpp:23
Definition: creation_analyzer_helper.h:41
bool is_success
Definition: creation_analyzer_helper.h:43
OutputInfo output
Definition: creation_analyzer_helper.h:42
Definition: creation_analyzer_helper.h:46
std::string selector_args
Definition: creation_analyzer_helper.h:48
std::string android_host_out
Definition: creation_analyzer_helper.h:51
std::string cmd_args
Definition: creation_analyzer_helper.h:49
Expected expected_output
Definition: creation_analyzer_helper.h:54
std::string home
Definition: creation_analyzer_helper.h:50
Definition: creation_analyzer_helper.h:32
std::string group_name
Definition: creation_analyzer_helper.h:35
std::unordered_map< std::string, std::string > envs
Definition: creation_analyzer_helper.h:38
std::vector< std::string > args
Definition: creation_analyzer_helper.h:37
std::vector< unsigned > instances
Definition: creation_analyzer_helper.h:36
std::string home
Definition: creation_analyzer_helper.h:33
std::string host_artifacts_path
e.g. out/host/linux-x86
Definition: creation_analyzer_helper.h:34