Beispiel #1
0
ATF_TC_BODY(getcwd, tc)
{
    atf_fs_path_t cwd1, cwd2;

    create_dir ("root", 0755);

    RE(atf_fs_getcwd(&cwd1));
    ATF_REQUIRE(chdir("root") != -1);
    RE(atf_fs_getcwd(&cwd2));

    RE(atf_fs_path_append_fmt(&cwd1, "root"));

    ATF_REQUIRE(atf_equal_fs_path_fs_path(&cwd1, &cwd2));

    atf_fs_path_fini(&cwd2);
    atf_fs_path_fini(&cwd1);
}
Beispiel #2
0
atf_error_t
atf_fs_path_to_absolute(const atf_fs_path_t *p, atf_fs_path_t *pa)
{
    atf_error_t err;

    PRE(!atf_fs_path_is_absolute(p));

    err = atf_fs_getcwd(pa);
    if (atf_is_error(err))
        goto out;

    err = atf_fs_path_append_path(pa, p);
    if (atf_is_error(err))
        atf_fs_path_fini(pa);

out:
    return err;
}