aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2025-02-14 10:05:58 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2025-02-14 10:05:58 -0500
commit1762aa42cd86e0bb2631631488bf8b2474378f83 (patch)
tree210c031a88ed9c439b8faa9b21828eee67e154d7 /tests
parent014eb7d96a55067aec4c6b81cf50072f90df5b5f (diff)
downloadstasis-1762aa42cd86e0bb2631631488bf8b2474378f83.tar.gz
Move cli/stasis main program to a library stasis_entrypoint.a
Diffstat (limited to 'tests')
-rw-r--r--tests/test_artifactory.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/tests/test_artifactory.c b/tests/test_artifactory.c
index 4af7eec..fab9d1d 100644
--- a/tests/test_artifactory.c
+++ b/tests/test_artifactory.c
@@ -71,13 +71,10 @@ int main(int argc, char *argv[]) {
memset(&gnoauth, 0, sizeof(gnoauth));
memset(&ctx, 0, sizeof(ctx));
- char *basedir = realpath(".", NULL);
- const char *ws = "workspace";
- mkdir(ws, 0755);
- if (pushd(ws)) {
- SYSERROR("failed to change directory to %s", ws);
- guard_free(basedir);
- STASIS_ASSERT_FATAL(true, "workspace creation failed");
+ char basedir[PATH_MAX] = {0};
+ if (getcwd(basedir, PATH_MAX) == NULL) {
+ SYSERROR("%s", "Unable to get current working directory");
+ return 1;
}
// enable messages from the jf tool
@@ -97,7 +94,7 @@ int main(int argc, char *argv[]) {
setenv("PATH", path, 1);
// The default config contains the URL information to download jfrog-cli
- char cfg_path[PATH_MAX] = {0};
+ char cfg_path[PATH_MAX*2] = {0};
if (strstr(sysconfdir, "..")) {
sprintf(cfg_path, "%s/%s/stasis.ini", basedir, sysconfdir);
} else {
@@ -106,7 +103,6 @@ int main(int argc, char *argv[]) {
ctx._stasis_ini_fp.cfg = ini_open(cfg_path);
if (!ctx._stasis_ini_fp.cfg) {
SYSERROR("%s: configuration is invalid", cfg_path);
- guard_free(basedir);
return STASIS_TEST_SUITE_SKIP;
}
delivery_init_platform(&ctx);
@@ -118,7 +114,6 @@ int main(int argc, char *argv[]) {
SYSERROR("%s", "Not configured to test Artifactory. Skipping.");
return STASIS_TEST_SUITE_SKIP;
}
- guard_free(basedir);
STASIS_TEST_FUNC *tests[] = {
test_jfrog_cli_rt_ping,
@@ -129,4 +124,4 @@ int main(int argc, char *argv[]) {
STASIS_TEST_RUN(tests);
popd();
STASIS_TEST_END_MAIN();
-} \ No newline at end of file
+}