tests/cfg_yaml_ut.cpp
/* Test Fixture. */
/*************************************************************/
/**
 * Verify that the yaml_parse_* APIs
 * - succeeds when the manifest file doesn't point to yaml files.
 ****************************************************************/
Test Fixture.
Verify that the yaml_parse_* APIs
- succeeds when the manifest file doesn't point to yaml files.
Test Fixture . Verify that the yaml_parse_ * APIs - succeeds when the manifest file doesn ' t point to yaml files .
TEST_F(CfgYamlTestSuite, cfg_007_yaml_parse_unspecified_bad_files) {
    char    cwd[1024];
    int     rc = 0;
    rc = snprintf(cwd, sizeof(cwd), "%s/%s", CFG_YAML_UT_FILE_DIR, "yaml_files");
    ASSERT_GT(rc, 0);
    unlink_file(cwd, MANIFEST_FILE);
    link_file(cwd, EMPTY_MANIFEST, MANIFEST_FILE);
    printf("Create a new base SUBSYSTEM.\n");
    rc = yaml_add_subsystem(cy_handle, BASE_SUBSYSTEM, cwd);
    ASSERT_EQ(rc, 0);
    printf("Parse devices with valid subsystem.\n");
    rc = yaml_parse_devices(cy_handle, BASE_SUBSYSTEM);
    ASSERT_EQ(rc, 0);
    printf("Parse thermal with no thermal in manifest file.\n");
    rc = yaml_parse_thermal(cy_handle, BASE_SUBSYSTEM);
    ASSERT_EQ(rc, 0);
    printf("Parse ports with no ports in manifest file.\n");
    rc = yaml_parse_ports(cy_handle, BASE_SUBSYSTEM);
    ASSERT_EQ(rc, 0);
    printf("Parse fans with no fans in manifest file.\n");
    rc = yaml_parse_fans(cy_handle, BASE_SUBSYSTEM);
    ASSERT_EQ(rc, 0);
    printf("Parse power with no power in manifest file.\n");
    rc = yaml_parse_psus(cy_handle, BASE_SUBSYSTEM);
    ASSERT_EQ(rc, 0);
    printf("Parse leds with no leds in manifest file.\n");
    rc = yaml_parse_leds(cy_handle, BASE_SUBSYSTEM);
    ASSERT_EQ(rc, 0);
    printf("Parse fru with no fru in manifest file.\n");
    rc = yaml_parse_fru(cy_handle, BASE_SUBSYSTEM);
    ASSERT_EQ(rc, -1);
    unlink_file(cwd, MANIFEST_FILE);
}
TEST_F ( CfgYamlTestSuite , cfg_007_yaml_parse_unspecified_bad_files ) { char cwd [ 1024 ] ; int rc = 0 ; rc = snprintf ( cwd , sizeof ( cwd ) , " " , CFG_YAML_UT_FILE_DIR , " " ) ; ASSERT_GT ( rc , 0 ) ; unlink_file ( cwd , MANIFEST_FILE ) ; link_file ( cwd , EMPTY_MANIFEST , MANIFEST_FILE ) ; printf ( " \n " ) ; rc = yaml_add_subsystem ( cy_handle , BASE_SUBSYSTEM , cwd ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; rc = yaml_parse_devices ( cy_handle , BASE_SUBSYSTEM ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; rc = yaml_parse_thermal ( cy_handle , BASE_SUBSYSTEM ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; rc = yaml_parse_ports ( cy_handle , BASE_SUBSYSTEM ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; rc = yaml_parse_fans ( cy_handle , BASE_SUBSYSTEM ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; rc = yaml_parse_psus ( cy_handle , BASE_SUBSYSTEM ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; rc = yaml_parse_leds ( cy_handle , BASE_SUBSYSTEM ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; rc = yaml_parse_fru ( cy_handle , BASE_SUBSYSTEM ) ; ASSERT_EQ ( rc , -1 ) ; unlink_file ( cwd , MANIFEST_FILE ) ; }
Test Fixture.
Test Fixture .
/* Test YAML files are stored in ./yaml_files dir. */ /* Try creating a subsystem. It should PASS. */ /* Call yaml_parse_devices() with valid subsystem,
     * and valid directory. The call should pass */ /* Call yaml_parse_thermal() with valid subsystem,
     * and valid directory. The call should pass */ /* Call yaml_parse_ports() with valid subsystem,
     * and valid directory. The call should pass */ /* Call yaml_parse_fans() with valid subsystem,
     * and valid directory. The call should pass */ /* Call yaml_parse_psus() with valid subsystem,
     * and valid directory. The call should pass */ /* Call yaml_parse_leds() with valid subsystem,
     * and valid directory. The call should pass */ /* Call yaml_parse_fru() with valid subsystem,
     * and valid directory. The call should pass */