src/test/test-build-path.c
raw| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | |
| 3 | #include "alloc-util.h" |
| 4 | #include "build-path.h" |
| 5 | #include "log.h" |
| 6 | #include "string-util.h" |
| 7 | |
| 8 | int main(int argc, char* argv[]) { |
| 9 | _cleanup_free_ char *p = NULL; |
| 10 | int r; |
| 11 | |
| 12 | r = get_build_exec_dir(&p); |
| 13 | if (r == -ENOEXEC) |
| 14 | log_info("Not run from build dir."); |
| 15 | else if (r < 0) |
| 16 | log_error_errno(r, "Failed to find build dir: %m"); |
| 17 | else |
| 18 | log_info("%s", strna(p)); |
| 19 | |
| 20 | return 0; |
| 21 | } |