(Temporarily) disable UNC tests by ethomson · Pull Request #4256 · libgit2/libgit2 · GitHub
Skip to content

(Temporarily) disable UNC tests - #4256

Merged
ethomson merged 1 commit into
masterfrom
ethomson/unc_tests
Jun 7, 2017
Merged

ethomson merged 1 commit into
masterfrom
ethomson/unc_tests

Conversation

@ethomson

@ethomson ethomson commented Jun 7, 2017

Copy link
Copy Markdown
Member

Temporarily disable the UNC tests when running in AppVeyor. Temporary workaround for: appveyor/ci#1579

@pks-t

pks-t commented Jun 7, 2017

Copy link
Copy Markdown
Member

@pks-t

pks-t commented Jun 7, 2017

Copy link
Copy Markdown
Member

E.g.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1cf47fea..48cec179f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -706,9 +706,9 @@ IF (BUILD_CLAR)
 
 	ENABLE_TESTING()
 	IF (WINHTTP OR OPENSSL_FOUND OR SECURITY_FOUND)
-		ADD_TEST(libgit2_clar libgit2_clar -ionline)
+		ADD_TEST(libgit2_clar libgit2_clar -ionline -xclone::unc)
 	ELSE ()
-		ADD_TEST(libgit2_clar libgit2_clar -v)
+		ADD_TEST(libgit2_clar libgit2_clar -v -xclone::unc)
 	ENDIF ()
 
 	# Add a test target which runs the cred callback tests, to be
diff --git a/tests/clone/local.c b/tests/clone/local.c
index 7f54d05de..78d026794 100644
--- a/tests/clone/local.c
+++ b/tests/clone/local.c
@@ -16,42 +16,6 @@ static int file_url(git_buf *buf, const char *host, const char *path)
 	return git_buf_printf(buf, "file://%s/%s", host, path);
 }
 
-#ifdef GIT_WIN32
-static int git_style_unc_path(git_buf *buf, const char *host, const char *path)
-{
-	git_buf_clear(buf);
-
-	if (host)
-		git_buf_printf(buf, "//%s/", host);
-
-	if (path[0] == '/')
-		path++;
-
-	if (git__isalpha(path[0]) && path[1] == ':' && path[2] == '/') {
-		git_buf_printf(buf, "%c$/", path[0]);
-		path += 3;
-	}
-
-	git_buf_puts(buf, path);
-
-	return git_buf_oom(buf) ? -1 : 0;
-}
-
-static int unc_path(git_buf *buf, const char *host, const char *path)
-{
-	char *c;
-
-	if (git_style_unc_path(buf, host, path) < 0)
-		return -1;
-
-	for (c = buf->ptr; *c; c++)
-		if (*c == '/')
-			*c = '\\';
-
-	return 0;
-}
-#endif
-
 void test_clone_local__should_clone_local(void)
 {
 	git_buf buf = GIT_BUF_INIT;
@@ -157,57 +121,3 @@ void test_clone_local__hardlinks(void)
 	cl_git_pass(git_futils_rmdir_r("./clone3.git", NULL, GIT_RMDIR_REMOVE_FILES));
 	cl_git_pass(git_futils_rmdir_r("./clone4.git", NULL, GIT_RMDIR_REMOVE_FILES));
 }
-
-void test_clone_local__standard_unc_paths_are_written_git_style(void)
-{
-#ifdef GIT_WIN32
-	git_repository *repo;
-	git_remote *remote;
-	git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
-	git_buf unc = GIT_BUF_INIT, git_unc = GIT_BUF_INIT;
-
-	/* we use a fixture path because it needs to exist for us to want to clone */
-	const char *path = cl_fixture("testrepo.git");
-
-	cl_git_pass(unc_path(&unc, "localhost", path));
-	cl_git_pass(git_style_unc_path(&git_unc, "localhost", path));
-
-	cl_git_pass(git_clone(&repo, unc.ptr, "./clone.git", &opts));
-	cl_git_pass(git_remote_lookup(&remote, repo, "origin"));
-
-	cl_assert_equal_s(git_unc.ptr, git_remote_url(remote));
-
-	git_remote_free(remote);
-	git_repository_free(repo);
-	git_buf_free(&unc);
-	git_buf_free(&git_unc);
-
-	cl_git_pass(git_futils_rmdir_r("./clone.git", NULL, GIT_RMDIR_REMOVE_FILES));
-#endif
-}
-
-void test_clone_local__git_style_unc_paths(void)
-{
-#ifdef GIT_WIN32
-	git_repository *repo;
-	git_remote *remote;
-	git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
-	git_buf git_unc = GIT_BUF_INIT;
-
-	/* we use a fixture path because it needs to exist for us to want to clone */
-	const char *path = cl_fixture("testrepo.git");
-
-	cl_git_pass(git_style_unc_path(&git_unc, "localhost", path));
-
-	cl_git_pass(git_clone(&repo, git_unc.ptr, "./clone.git", &opts));
-	cl_git_pass(git_remote_lookup(&remote, repo, "origin"));
-
-	cl_assert_equal_s(git_unc.ptr, git_remote_url(remote));
-
-	git_remote_free(remote);
-	git_repository_free(repo);
-	git_buf_free(&git_unc);
-
-	cl_git_pass(git_futils_rmdir_r("./clone.git", NULL, GIT_RMDIR_REMOVE_FILES));
-#endif
-}
diff --git a/tests/clone/unc.c b/tests/clone/unc.c
new file mode 100644
index 000000000..7e36d21cb
--- /dev/null
+++ b/tests/clone/unc.c
@@ -0,0 +1,105 @@
+#include "clar_libgit2.h"
+
+#include "git2/clone.h"
+#include "clone.h"
+#include "buffer.h"
+#include "path.h"
+#include "posix.h"
+#include "fileops.h"
+
+void test_clone_unc__initialize(void)
+{
+#ifndef GIT_WIN32
+	cl_skip();
+#endif
+}
+
+#ifdef GIT_WIN32
+static int git_style_unc_path(git_buf *buf, const char *host, const char *path)
+{
+	git_buf_clear(buf);
+
+	if (host)
+		git_buf_printf(buf, "//%s/", host);
+
+	if (path[0] == '/')
+		path++;
+
+	if (git__isalpha(path[0]) && path[1] == ':' && path[2] == '/') {
+		git_buf_printf(buf, "%c$/", path[0]);
+		path += 3;
+	}
+
+	git_buf_puts(buf, path);
+
+	return git_buf_oom(buf) ? -1 : 0;
+}
+
+static int unc_path(git_buf *buf, const char *host, const char *path)
+{
+	char *c;
+
+	if (git_style_unc_path(buf, host, path) < 0)
+		return -1;
+
+	for (c = buf->ptr; *c; c++)
+		if (*c == '/')
+			*c = '\\';
+
+	return 0;
+}
+#endif
+
+void test_clone_unc__standard_unc_paths_are_written_git_style(void)
+{
+#ifdef GIT_WIN32
+	git_repository *repo;
+	git_remote *remote;
+	git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
+	git_buf unc = GIT_BUF_INIT, git_unc = GIT_BUF_INIT;
+
+	/* we use a fixture path because it needs to exist for us to want to clone */
+	const char *path = cl_fixture("testrepo.git");
+
+	cl_git_pass(unc_path(&unc, "localhost", path));
+	cl_git_pass(git_style_unc_path(&git_unc, "localhost", path));
+
+	cl_git_pass(git_clone(&repo, unc.ptr, "./clone.git", &opts));
+	cl_git_pass(git_remote_lookup(&remote, repo, "origin"));
+
+	cl_assert_equal_s(git_unc.ptr, git_remote_url(remote));
+
+	git_remote_free(remote);
+	git_repository_free(repo);
+	git_buf_free(&unc);
+	git_buf_free(&git_unc);
+
+	cl_git_pass(git_futils_rmdir_r("./clone.git", NULL, GIT_RMDIR_REMOVE_FILES));
+#endif
+}
+
+void test_clone_unc__git_style_unc_paths(void)
+{
+#ifdef GIT_WIN32
+	git_repository *repo;
+	git_remote *remote;
+	git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
+	git_buf git_unc = GIT_BUF_INIT;
+
+	/* we use a fixture path because it needs to exist for us to want to clone */
+	const char *path = cl_fixture("testrepo.git");
+
+	cl_git_pass(git_style_unc_path(&git_unc, "localhost", path));
+
+	cl_git_pass(git_clone(&repo, git_unc.ptr, "./clone.git", &opts));
+	cl_git_pass(git_remote_lookup(&remote, repo, "origin"));
+
+	cl_assert_equal_s(git_unc.ptr, git_remote_url(remote));
+
+	git_remote_free(remote);
+	git_repository_free(repo);
+	git_buf_free(&git_unc);
+
+	cl_git_pass(git_futils_rmdir_r("./clone.git", NULL, GIT_RMDIR_REMOVE_FILES));
+#endif
+}

@ethomson

ethomson commented Jun 7, 2017

Copy link
Copy Markdown
Member Author

Hmm... yeah, that will work in this case (since we're fine skipping the UNC tests on Travis, too). But that's not an ideal way to skip tests on only AppVeyor but keep running them on Travis. And it affects anybody who runs these via ctest on their local machines.

🤔

I guess that's okay though. This is rather temporary. If we need to deal with this sort of a problem in the future then it's fairly easy to change the appveyor/travis configuration to run libgit2_clar directly instead of running them via ctest.

@pks-t

pks-t commented Jun 7, 2017

Copy link
Copy Markdown
Member

True. I also thought about adding a new test target. So instead of executing all our current targets one by one in both Travis and AppVeyor, which is prone to become out of sync anyways, we could just add a libgit2_clar-ci test target which runs all tests at once.

(Temporarily) disable UNC path tests to work around AppVeyor issues.
@ethomson
ethomson force-pushed the ethomson/unc_tests branch from 6e24e87 to f218508 Compare June 7, 2017 09:56
@ethomson

ethomson commented Jun 7, 2017

Copy link
Copy Markdown
Member Author

Yeah. Let's -x them out for now and we can revisit this if/when it becomes a problem again.

@pks-t

pks-t commented Jun 7, 2017

Copy link
Copy Markdown
Member

Nice, thanks 👍

I'll include my CI target proposal in #4257.

@ethomson

ethomson commented Jun 7, 2017

Copy link
Copy Markdown
Member Author

@ethomson
ethomson merged commit 6a13cf1 into master Jun 7, 2017
@ethomson
ethomson deleted the ethomson/unc_tests branch January 9, 2019 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants