1 /*
2 * Helper function to check -e status option.
3 *
4 * Copyright (c) 2019 Intel Corporation
5 * Copyright (c) 2019 Paul Chaignon <paul.chaignon@gmail.com>
6 * All rights reserved.
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #include "tests.h"
12 #include <stdio.h>
13 #include <unistd.h>
14
15 void
16 test_status_chdir(const char *dir, bool print_success, bool print_fail)
17 {
18 long rc = chdir(dir);
19 if ((rc == -1 && print_fail) || (rc != -1 && print_success))
20 printf("chdir(\"%s\") = %s\n", dir, sprintrc(rc));
21 }