SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
SET(PASS_SRCS
+ ${CMAKE_SOURCE_DIR}/src/util/common.c
${CMAKE_SOURCE_DIR}/src/pass/pass-hal.c
+ ${CMAKE_SOURCE_DIR}/src/pass/pass-parser.c
)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ PASS_UNITTEST_SRCS)
#include "pass.h"
#include "pass-hal.h"
+#include "pass-parser.h"
}
#include "hal-api-power-mock.hpp"
EXPECT_NE(ret, 0);
}
+/* Unittest of pass-parser module */
+class PassParserTest : public testing::Test {
+public:
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+};
+
+TEST(PassParserTest, pass_parser_get_resource_config_valid) {
+ struct pass pass;
+ const char path_json[] = "./scripts/valid/pass.json";
+
+ int ret = pass_parser_get_resource_config(&pass, path_json);
+ ASSERT_EQ(ret, 0);
+
+ pass_parser_put_resource_config(&pass);
+}
+
+TEST(PassParserTest, pass_parser_get_resource_config_invalid) {
+ struct pass pass;
+ const char path_json[] = "./scripts/invalid/pass.json";
+
+ int ret = pass_parser_get_resource_config(&pass, path_json);
+ EXPECT_NE(ret, 0);
+}
+
int main(int argc, char *argv[])
{
try {
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ //"device_type" : "cpu",
+ //"device_name" : "cpu0",
+ //"device_config_path" : "./scripts/valid/pass-cpu0.json",
+ "thermal_device_name" : "thermal_zone0",
+ "cpu,number_of_cpus" : 4,
+ "cpu,first_cpu" : 0
+ }, {
+ //"device_type" : "cpu",
+ "device_name" : "cpu4",
+ "device_config_path" : "./scripts/valid/pass-cpu4.json",
+ "thermal_device_name" : "thermal_zone1",
+ "cpu,number_of_cpus" : 4,
+ "cpu,first_cpu" : 4
+ }, {
+ "device_type" : "bus",
+ "device_name" : "devfreq0",
+ //"device_config_path" : "./scripts/valid/pass-bus.json",
+ "thermal_device_name" : null
+ }, {
+ "device_type" : "bus",
+ //"device_name" : "devfreq5",
+ "device_config_path" : "./scripts/valid/pass-bus1.json",
+ "thermal_device_name" : null
+ }, {
+ "device_type" : "gpu",
+ "device_name" : "devfreq10",
+ //"device_config_path" : "./scripts/vaild/pass-gpu.json",
+ "thermal_device_name" : "thermal_zone3"
+ }, {
+ "device_type" : "memory",
+ "device_name" : "memory",
+ //"device_config_path" : "./scripts/valid/pass-memory.json"
+ }, {
+ "device_type" : "battery",
+ //"device_name" : "battery",
+ "device_config_path" : "./scripts/valid/pass-battery.json",
+ "thermal_device_name" : "thermal_zone5",
+ "cooling_device_name" : null
+ }
+ ]
+}
--- /dev/null
+{
+ "device_list" :
+ [
+ {
+ "device_type" : "cpu",
+ "device_name" : "cpu0",
+ "device_config_path" : "./scripts/valid/pass-cpu0.json",
+ "thermal_device_name" : "thermal_zone0",
+ "cpu,number_of_cpus" : 4,
+ "cpu,first_cpu" : 0
+ }, {
+ "device_type" : "cpu",
+ "device_name" : "cpu4",
+ "device_config_path" : "./scripts/valid/pass-cpu4.json",
+ "thermal_device_name" : "thermal_zone1",
+ "cpu,number_of_cpus" : 4,
+ "cpu,first_cpu" : 4
+ }, {
+ "device_type" : "bus",
+ "device_name" : "devfreq0",
+ "device_config_path" : "./scripts/valid/pass-bus0.json",
+ "thermal_device_name" : null
+ }, {
+ "device_type" : "bus",
+ "device_name" : "devfreq5",
+ "device_config_path" : "./scripts/valid/pass-bus1.json",
+ "thermal_device_name" : null
+ }, {
+ "device_type" : "gpu",
+ "device_name" : "devfreq10",
+ "device_config_path" : "./scripts/valid/pass-gpu.json",
+ "thermal_device_name" : "thermal_zone3"
+ }, {
+ "device_type" : "memory",
+ "device_name" : "memory",
+ "device_config_path" : "./scripts/valid/pass-memory.json"
+ }, {
+ "device_type" : "battery",
+ "device_name" : "battery",
+ "device_config_path" : "./scripts/valid/pass-battery.json",
+ "thermal_device_name" : "thermal_zone5",
+ "cooling_device_name" : null
+ }
+ ]
+}