for (i = 0; i < (int)pass.num_resources; i++) {
struct pass_resource *res = &pass.res[i];
-
ret = pass_parser_get_each_resource_config(res,
res->config_data.path_conf_file);
EXPECT_EQ(ret, 0);
pass_parser_put_resource_config(&pass);
}
+class ResourceConfigInvalid {
+public:
+ const char *path_json;
+
+ ResourceConfigInvalid(
+ const char *path_json_) :
+ path_json(path_json_) {}
+};
+
+class PassParserInvalidTest : public ::testing::TestWithParam<ResourceConfigInvalid> {};
+
+INSTANTIATE_TEST_CASE_P (PassParserTest, PassParserInvalidTest,
+ ::testing::Values (
+ ResourceConfigInvalid ("./scripts/invalid-level/pass.json"),
+ ResourceConfigInvalid ("./scripts/invalid-pmqos/pass.json"),
+ ResourceConfigInvalid ("./scripts/invalid-thermal/pass.json"),
+ ResourceConfigInvalid ("./scripts/invalid-thermal/pass1.json"),
+ ResourceConfigInvalid ("./scripts/invalid-header/pass.json"),
+ ResourceConfigInvalid ("./scripts/invalid-battery/pass.json"),
+ ResourceConfigInvalid ("./scripts/invalid-memory/pass.json")
+));
+
+TEST_P(PassParserInvalidTest, pass_parser_get_each_resource_config_invalid) {
+ auto param = GetParam();
+ struct pass pass;
+ unsigned int i;
+
+ int ret = pass_parser_get_resource_config(&pass, param.path_json);
+ EXPECT_EQ(ret, 0);
+
+ for (i = 0; i < pass.num_resources; i++) {
+ struct pass_resource *res = &pass.res[i];
+ ret = pass_parser_get_each_resource_config(res,
+ res->config_data.path_conf_file);
+ EXPECT_NE(ret, 0);
+ }
+
+ for (i = 0; i < pass.num_resources; i++)
+ pass_parser_put_each_resource_config(&pass.res[i]);
+ pass_parser_put_resource_config(&pass);
+}
+
int main(int argc, char *argv[])
{
try {
--- /dev/null
+{
+ "support" : true,
+ "init_level" : 0,
+ "level_list" :
+ [
+ {
+ "level" : 0,
+ //"battery,charging_status" : 0, // POWER_SUPPLY_STATUS_UNKNOWN
+ //"battery_charging_currnt_uA" : 2048000
+ }, {
+ "level" : 1,
+ //"battery,charging_status" : 0, // POWER_SUPPLY_STATUS_UNKNOWN
+ //"battery,charging_currnt_uA" : 1024000
+ }, {
+ //"level" : 2,
+ //"battery,charging_status" : 3, // POWER_SUPPLY_STATUS_NOT_CHARGING
+ //"battery,charging_currnt_uA" : 1024000
+ }
+ ],
+
+ "pmqos_support" : false,
+
+ "thermal_support" : true,
+ "thermal_timer_interval_ms" : 5000,
+ "thermal_scenario_list":
+ [
+ {
+ "name" : "Release",
+ "temperature" : { "start": 0, "end": 45, "threshold": 42},
+ "timer_interval_ms" : 5000,
+ "target_level" : 0
+ }, {
+ "name" : "Warning",
+ "temperature" : { "start": 45, "end": 50, "threshold": 47},
+ "timer_interval_ms" : 3000,
+ "target_level" : 1
+ }, {
+ "name" : "LimitAction",
+ "temperature" : { "start": 50, "end": 55, "threshold": 52},
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }, {
+ "name" : "Shutdown",
+ "temperature" : { "start": 55, "end": 100 },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }
+ ],
+
+ "cpuhp_support" : false
+}
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ "device_type" : "battery",
+ "device_name" : "battery",
+ "device_config_path" : "./scripts/invalid-battery/pass-battery.json",
+ "thermal_device_name" : "thermal_zone5",
+ "cooling_device_name" : null
+ }
+ ]
+}
--- /dev/null
+{
+ "support" : true,
+ //"init_level" : 0,
+ //"level_list" :
+ [
+ {
+ "level" : 0,
+ "dvfs,minimum_frequency_khz" : 138000000,
+ "dvfs,maximum_frequency_khz" : 413000000
+ }, {
+ "level" : 1,
+ "dvfs,minimum_frequency_khz" : 138000000,
+ "dvfs,maximum_frequency_khz" : 138000000
+ }, {
+ "level" : 2,
+ "dvfs,minimum_frequency_khz" : 138000000,
+ "dvfs,maximum_frequency_khz" : 275000000
+ }, {
+ "level" : 3,
+ "dvfs,minimum_frequency_khz" : 413000000,
+ "dvfs,maximum_frequency_khz" : 413000000
+ }
+ ],
+
+ "pmqos_support" : true,
+ "pmqos_scenario_list":
+ [
+ {
+ "name" : "AppLaunch",
+ "target_level" : 3
+ }, {
+ "name" : "UltraPowerSaving",
+ "target_level" : 1
+ }, {
+ "name" : "Doze",
+ "target_level" : 2
+ }, {
+ "name" : "Performance",
+ "target_level" : 3
+ }
+ ],
+
+ "thermal_support" : false,
+
+ "cpuhp_support" : false
+}
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ "device_type" : "bus",
+ "device_name" : "devfreq0",
+ "device_config_path" : "./scripts/invalid-bus/pass-bus0.json",
+ "thermal_device_name" : null
+ }
+ ]
+}
--- /dev/null
+{
+ "support" : true,
+ "init_level" : 0,
+ "level_list" :
+ [
+ {
+ "level" : 0,
+ "dvfs,minimum_frequency_khz" : 600000,
+ "dvfs,maximum_frequency_khz" : 1500000
+ }, {
+ "level" : 1,
+ "dvfs,minimum_frequency_khz" : 1500000,
+ "dvfs,maximum_frequency_khz" : 1500000
+ }, {
+ //"level" : 2,
+ "dvfs,minimum_frequency_khz" : 600000,
+ "dvfs,maximum_frequency_khz" : 600000
+ }
+ ],
+
+ "pmqos_support" : true,
+ "pmqos_scenario_list":
+ [
+ {
+ "name" : "AppLaunch",
+ "target_level" : 1
+ }, {
+ "name" : "UltraPowerSaving",
+ "target_level" : 2
+ }, {
+ "name" : "Performance",
+ "target_level" : 1
+ }
+ ],
+
+ "thermal_support" : true,
+ "thermal_timer_interval_ms" : 5000,
+ "thermal_scenario_list":
+ [
+ {
+ "name" : "Release",
+ "temperature" : { "start": 0, "end": 75, "threshold": 72},
+ "timer_interval_ms" : 5000,
+ "target_level" : 0
+ }, {
+ "name" : "Warning",
+ "temperature" : { "start": 75, "end": 80, "threshold": 77 },
+ "timer_interval_ms" : 3000,
+ "target_level" : 0
+ }, {
+ "name" : "LimitAction",
+ "temperature" : { "start": 80, "end": 85, "threshold": 82 },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }, {
+ "name" : "Shutdown",
+ "temperature" : { "start": 85, "end": 100 },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }
+ ],
+
+ "cpuhp_support" : false
+}
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ "device_type" : "cpu",
+ "device_name" : "cpu0",
+ "device_config_path" : "./scripts/invalid-level/pass-cpu0.json",
+ "thermal_device_name" : "thermal_zone0",
+ "cpu,number_of_cpus" : 4,
+ "cpu,first_cpu" : 0
+ }
+ ]
+}
--- /dev/null
+{
+ "support" : true,
+ "init_level" : 0,
+ "level_list" :
+ [
+ {
+ "level" : 0,
+ "memory,fault_around_bytes" : 4096
+ }, {
+ //"level" : 1,
+ //"memory,fault_around_bytes" : 65536
+ }
+ ],
+
+ "pmqos_support" : true,
+ "pmqos_scenario_list" :
+ [
+ {
+ "name" : "AppLaunch",
+ "target_level" : 0
+ }, {
+ "name" : "UltraPowerSaving",
+ "target_level" : 0
+ }, {
+ "name" : "Performance",
+ "target_level" : 1
+ }
+ ],
+
+ "thermal_support" : false,
+
+ "cpuhp_support" : false
+}
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ "device_type" : "memory",
+ "device_name" : "memory",
+ "device_config_path" : "./scripts/invalid-memory/pass-memory.json"
+ }
+ ]
+}
--- /dev/null
+{
+ "support" : true,
+ "init_level" : 0,
+ "level_list" :
+ [
+ {
+ "level" : 0,
+ "dvfs,minimum_frequency_khz" : 600000,
+ "dvfs,maximum_frequency_khz" : 1500000
+ }, {
+ "level" : 1,
+ "dvfs,minimum_frequency_khz" : 1500000,
+ "dvfs,maximum_frequency_khz" : 1500000
+ }, {
+ "level" : 2,
+ "dvfs,minimum_frequency_khz" : 600000,
+ "dvfs,maximum_frequency_khz" : 600000
+ }
+ ],
+
+ "pmqos_support" : true,
+ "pmqos_scenario_list":
+ [
+ {
+ "name" : "AppLaunch",
+ "target_level" : 1
+ }, {
+ //"name" : "UltraPowerSaving",
+ //"target_level" : 2
+ }, {
+ "name" : "Performance",
+ "target_level" : 1
+ }
+ ],
+
+ "thermal_support" : true,
+ "thermal_timer_interval_ms" : 5000,
+ "thermal_scenario_list":
+ [
+ {
+ "name" : "Release",
+ "temperature" : { "start": 0, "end": 75, "threshold": 72},
+ "timer_interval_ms" : 5000,
+ "target_level" : 0
+ }, {
+ "name" : "Warning",
+ "temperature" : { "start": 75, "end": 80, "threshold": 77 },
+ "timer_interval_ms" : 3000,
+ "target_level" : 0
+ }, {
+ "name" : "LimitAction",
+ "temperature" : { "start": 80, "end": 85, "threshold": 82 },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }, {
+ "name" : "Shutdown",
+ "temperature" : { "start": 85, "end": 100 },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }
+ ],
+
+ "cpuhp_support" : false
+}
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ "device_type" : "cpu",
+ "device_name" : "cpu0",
+ "device_config_path" : "./scripts/invalid-pmqos/pass-cpu0.json",
+ "thermal_device_name" : "thermal_zone0",
+ "cpu,number_of_cpus" : 4,
+ "cpu,first_cpu" : 0
+ }
+ ]
+}
--- /dev/null
+{
+ "support" : true,
+ "init_level" : 0,
+ "level_list" :
+ [
+ {
+ "level" : 0,
+ "dvfs,minimum_frequency_khz" : 600000,
+ "dvfs,maximum_frequency_khz" : 1500000
+ }, {
+ "level" : 1,
+ "dvfs,minimum_frequency_khz" : 1500000,
+ "dvfs,maximum_frequency_khz" : 1500000
+ }, {
+ "level" : 2,
+ "dvfs,minimum_frequency_khz" : 600000,
+ "dvfs,maximum_frequency_khz" : 600000
+ }
+ ],
+
+ "pmqos_support" : true,
+ "pmqos_scenario_list":
+ [
+ {
+ "name" : "AppLaunch",
+ "target_level" : 1
+ }, {
+ "name" : "UltraPowerSaving",
+ "target_level" : 2
+ }, {
+ "name" : "Performance",
+ "target_level" : 1
+ }
+ ],
+
+ "thermal_support" : true,
+ "thermal_timer_interval_ms" : 5000,
+ "thermal_scenario_list":
+ [
+ {
+ "name" : "Release",
+ "temperature" : { "start": 0, "end": 75, "threshold": 72},
+ "timer_interval_ms" : 5000,
+ "target_level" : 0
+ }, {
+ //"name" : "Warning",
+ //"temperature" : { "start": 75, "end": 80, "threshold": 77 },
+ //"timer_interval_ms" : 3000,
+ //"target_level" : 0
+ }, {
+ "name" : "LimitAction",
+ "temperature" : { "start": 80, "end": 85, "threshold": 82 },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }, {
+ "name" : "Shutdown",
+ "temperature" : { "start": 85, "end": 100 },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }
+ ],
+
+ "cpuhp_support" : false
+}
--- /dev/null
+{
+ "support" : true,
+ "init_level" : 0,
+ "level_list" :
+ [
+ {
+ "level" : 0,
+ "dvfs,minimum_frequency_khz" : 600000,
+ "dvfs,maximum_frequency_khz" : 1500000
+ }, {
+ "level" : 1,
+ "dvfs,minimum_frequency_khz" : 1500000,
+ "dvfs,maximum_frequency_khz" : 1500000
+ }, {
+ "level" : 2,
+ "dvfs,minimum_frequency_khz" : 600000,
+ "dvfs,maximum_frequency_khz" : 600000
+ }
+ ],
+
+ "pmqos_support" : true,
+ "pmqos_scenario_list":
+ [
+ {
+ "name" : "AppLaunch",
+ "target_level" : 1
+ }, {
+ "name" : "UltraPowerSaving",
+ "target_level" : 2
+ }, {
+ "name" : "Performance",
+ "target_level" : 1
+ }
+ ],
+
+ "thermal_support" : true,
+ "thermal_timer_interval_ms" : 5000,
+ "thermal_scenario_list":
+ [
+ {
+ "name" : "Release",
+ "temperature" : { "start": 0, "end": 75, "threshold": 72},
+ "timer_interval_ms" : 5000,
+ "target_level" : 0
+ }, {
+ "name" : "Warning",
+ "temperature" : { "start": 75, "end": 80, "threshold": 77 },
+ "timer_interval_ms" : 3000,
+ "target_level" : 0
+ }, {
+ "name" : "LimitAction",
+ "temperature" :
+ {
+ //"start": 80, "end": 85, "threshold": 82
+ },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }, {
+ "name" : "Shutdown",
+ "temperature" : { "start": 85, "end": 100 },
+ "timer_interval_ms" : 1000,
+ "target_level" : 2
+ }
+ ],
+
+ "cpuhp_support" : false
+}
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ "device_type" : "cpu",
+ "device_name" : "cpu0",
+ "device_config_path" : "./scripts/invalid-thermal/pass-cpu.json",
+ "thermal_device_name" : "thermal_zone0",
+ "cpu,number_of_cpus" : 4,
+ "cpu,first_cpu" : 0
+ }
+ ]
+}
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ "device_type" : "cpu",
+ "device_name" : "cpu0",
+ "device_config_path" : "./scripts/invalid-thermal/pass-cpu1.json",
+ "thermal_device_name" : "thermal_zone0",
+ "cpu,number_of_cpus" : 4,
+ "cpu,first_cpu" : 0
+ }
+ ]
+}