Skip to content

Commit eebc5e0

Browse files
authored
Merge pull request libgit2#4257 from pks-t/pks/stale-test
Execute stale tests
2 parents a223bae + 5874e15 commit eebc5e0

File tree

11 files changed

+43
-58
lines changed

11 files changed

+43
-58
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
- secure: "YnhS+8n6B+uoyaYfaJ3Lei7cSJqHDPiKJCKFIF2c87YDfmCvAJke8QtE7IzjYDs7UFkTCM4ox+ph2bERUrxZbSCyEkHdjIZpKuMJfYWja/jgMqTMxdyOH9y8JLFbZsSXDIXDwqBlC6vVyl1fP90M35wuWcNTs6tctfVWVofEFbs="
1818
- GITTEST_INVASIVE_FS_SIZE=1
1919
matrix:
20-
- OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_WERROR=ON"
20+
- OPTIONS="-DTHREADSAFE=ON -DENABLE_TRACE=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_WERROR=ON"
2121
- OPTIONS="-DTHREADSAFE=OFF -DBUILD_EXAMPLES=ON -DENABLE_WERROR=ON"
2222

2323
dist: trusty

appveyor.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,8 @@ test_script:
4848
# Run this early so we know it's ready by the time we need it
4949
$proxyJob = Start-Job { java -jar $Env:APPVEYOR_BUILD_FOLDER\build\poxyproxy.jar -d --port 8080 --credentials foo:bar }
5050
ctest -V -R libgit2_clar
51-
$env:GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
52-
$env:GITTEST_REMOTE_USER="libgit2test"
53-
ctest -V -R libgit2_clar-cred_callback
5451
Receive-Job -Job $proxyJob
55-
$env:GITTEST_REMOTE_PROXY_URL = "http://foo:bar@localhost:8080"
56-
ctest -V -R libgit2_clar-proxy_credentials_in_url
57-
$env:GITTEST_REMOTE_PROXY_URL = "http://localhost:8080"
52+
$env:GITTEST_REMOTE_PROXY_URL = "localhost:8080"
5853
$env:GITTEST_REMOTE_PROXY_USER = "foo"
5954
$env:GITTEST_REMOTE_PROXY_PASS = "bar"
60-
ctest -V -R libgit2_clar-proxy_credentials_request
55+
ctest -V -R libgit2_clar-proxy_credentials

script/cibuild.sh

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,32 +85,18 @@ else
8585
export GITTEST_REMOTE_SSH_FINGERPRINT=$(ssh-keygen -F '[localhost]:2222' -l | tail -n 1 | cut -d ' ' -f 2 | tr -d ':')
8686
fi
8787

88+
# Use the SSH server
8889
export GITTEST_REMOTE_URL="ssh://localhost:2222/$HOME/_temp/test.git"
8990
export GITTEST_REMOTE_USER=$USER
9091
export GITTEST_REMOTE_SSH_KEY="$HOME/.ssh/id_rsa"
9192
export GITTEST_REMOTE_SSH_PUBKEY="$HOME/.ssh/id_rsa.pub"
9293
export GITTEST_REMOTE_SSH_PASSPHRASE=""
94+
ctest -V -R libgit2_clar-ssh || exit $?
9395

94-
95-
if [ -e ./libgit2_clar ]; then
96-
./libgit2_clar -sonline::push -sonline::clone::ssh_cert &&
97-
./libgit2_clar -sonline::clone::ssh_with_paths || exit $?
98-
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
99-
./libgit2_clar -sonline::clone::cred_callback || exit $?
100-
fi
101-
102-
# Use the proxy we started at the beginning
103-
export GITTEST_REMOTE_PROXY_URL="http://foo:bar@localhost:8080/"
104-
./libgit2_clar -sonline::clone::proxy_credentials_in_url || exit $?
105-
export GITTEST_REMOTE_PROXY_URL="http://localhost:8080/"
106-
export GITTEST_REMOTE_PROXY_USER="foo"
107-
export GITTEST_REMOTE_PROXY_PASS="bar"
108-
./libgit2_clar -sonline::clone::proxy_credentials_request || exit $?
109-
110-
fi
96+
# Use the proxy we started at the beginning
97+
export GITTEST_REMOTE_PROXY_URL="localhost:8080"
98+
export GITTEST_REMOTE_PROXY_USER="foo"
99+
export GITTEST_REMOTE_PROXY_PASS="bar"
100+
ctest -V -R libgit2_clar-proxy_credentials || exit $?
111101

112102
kill $(cat "$HOME/sshd/pid")
113-
114-
export GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
115-
export GITTEST_REMOTE_USER="libgit2test"
116-
ctest -V -R libgit2_clar-cred_callback

tests/CMakeLists.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ENDIF()
2020

2121
ADD_CUSTOM_COMMAND(
2222
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/clar.suite
23-
COMMAND ${PYTHON_EXECUTABLE} generate.py -o "${CMAKE_CURRENT_BINARY_DIR}" -f -xonline -xstress .
23+
COMMAND ${PYTHON_EXECUTABLE} generate.py -o "${CMAKE_CURRENT_BINARY_DIR}" -f -xonline -xstress -xperf .
2424
DEPENDS ${SRC_TEST}
2525
WORKING_DIRECTORY ${CLAR_PATH}
2626
)
@@ -58,8 +58,6 @@ ELSE ()
5858
ADD_TEST(libgit2_clar "${libgit2_BINARY_DIR}/libgit2_clar" -v -xclone::local::git_style_unc_paths -xclone::local::standard_unc_paths_are_written_git_style)
5959
ENDIF ()
6060

61-
# Add a test target which runs the cred callback tests, to be
62-
# called after setting the url and user
63-
ADD_TEST(libgit2_clar-cred_callback "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::cred_callback)
64-
ADD_TEST(libgit2_clar-proxy_credentials_in_url "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_in_url)
65-
ADD_TEST(libgit2_clar-proxy_credentials_request "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_request)
61+
# Add additional test targets that require special setup
62+
ADD_TEST(libgit2_clar-proxy_credentials "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_in_url -sonline::clone::proxy_credentials_request)
63+
ADD_TEST(libgit2_clar-ssh "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths)

tests/checkout/tree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,8 @@ void test_checkout_tree__filemode_preserved_in_workdir(void)
10961096
cl_assert(!GIT_PERMS_IS_EXEC(read_filemode("a/b.txt")));
10971097

10981098
git_commit_free(commit);
1099+
#else
1100+
cl_skip();
10991101
#endif
11001102
}
11011103

tests/iterator/iterator_helpers.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ void expect_iterator_items(
5151
cl_assert(entry->mode != GIT_FILEMODE_TREE);
5252
}
5353

54-
if (++count >= expected_flat)
55-
break;
54+
cl_assert(++count <= expected_flat);
5655
}
5756

5857
assert_at_end(i, v);

tests/iterator/workdir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ void test_iterator_workdir__filesystem_gunk(void)
662662
/* should only have 13 items, since we're not asking for trees to be
663663
* returned. the goal of this test is simply to not crash.
664664
*/
665-
expect_iterator_items(i, 13, NULL, 13, NULL);
665+
expect_iterator_items(i, 15, NULL, 15, NULL);
666666
git_iterator_free(i);
667667
git_buf_free(&parent);
668668
}
@@ -741,6 +741,8 @@ void test_iterator_workdir__skips_fifos_and_special_files(void)
741741
cl_assert_equal_i(GIT_ITEROVER, git_iterator_advance(&e, i));
742742

743743
git_iterator_free(i);
744+
#else
745+
cl_skip();
744746
#endif
745747
}
746748

tests/online/clone.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ static int cred_failure_cb(
263263

264264
void test_online_clone__cred_callback_failure_return_code_is_tunnelled(void)
265265
{
266-
if (!_remote_url || !_remote_user)
267-
clar__skip();
266+
_remote_url = git__strdup("https://github.com/libgit2/non-existent");
267+
_remote_user = git__strdup("libgit2test");
268268

269269
g_options.fetch_opts.callbacks.credentials = cred_failure_cb;
270270

@@ -293,8 +293,8 @@ void test_online_clone__cred_callback_called_again_on_auth_failure(void)
293293
{
294294
size_t counter = 0;
295295

296-
if (!_remote_url || !_remote_user)
297-
clar__skip();
296+
_remote_url = git__strdup("https://github.com/libgit2/non-existent");
297+
_remote_user = git__strdup("libgit2test");
298298

299299
g_options.fetch_opts.callbacks.credentials = cred_count_calls_cb;
300300
g_options.fetch_opts.callbacks.payload = &counter;
@@ -677,24 +677,34 @@ static int proxy_creds(git_cred **out, const char *url, const char *username, un
677677

678678
void test_online_clone__proxy_credentials_request(void)
679679
{
680+
git_buf url = GIT_BUF_INIT;
681+
680682
if (!_remote_proxy_url || !_remote_proxy_user || !_remote_proxy_pass)
681683
cl_skip();
682684

685+
cl_git_pass(git_buf_printf(&url, "http://%s/", _remote_proxy_url));
686+
683687
g_options.fetch_opts.proxy_opts.type = GIT_PROXY_SPECIFIED;
684-
g_options.fetch_opts.proxy_opts.url = _remote_proxy_url;
688+
g_options.fetch_opts.proxy_opts.url = url.ptr;
685689
g_options.fetch_opts.proxy_opts.credentials = proxy_creds;
686690
called_proxy_creds = 0;
687691
cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/TestGitRepository", "./foo", &g_options));
688692
cl_assert(called_proxy_creds);
693+
694+
git_buf_free(&url);
689695
}
690696

691697
void test_online_clone__proxy_credentials_in_url(void)
692698
{
693-
if (!_remote_proxy_url)
699+
git_buf url = GIT_BUF_INIT;
700+
701+
if (!_remote_proxy_url || !_remote_proxy_user || !_remote_proxy_pass)
694702
cl_skip();
695703

704+
cl_git_pass(git_buf_printf(&url, "http://%s:%s@%s/", _remote_proxy_user, _remote_proxy_pass, _remote_proxy_url));
705+
696706
g_options.fetch_opts.proxy_opts.type = GIT_PROXY_SPECIFIED;
697-
g_options.fetch_opts.proxy_opts.url = _remote_proxy_url;
707+
g_options.fetch_opts.proxy_opts.url = url.ptr;
698708
called_proxy_creds = 0;
699709
cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/TestGitRepository", "./foo", &g_options));
700710
cl_assert(called_proxy_creds == 0);

tests/perf/merge.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,7 @@
2525
#define ID_BRANCH_A "d853fb9f24e0fe63b3dce9fbc04fd9cfe17a030b"
2626
#define ID_BRANCH_B "1ce9ea3ba9b4fa666602d52a5281d41a482cc58b"
2727

28-
29-
void test_perf_merge__initialize(void)
30-
{
31-
}
32-
33-
void test_perf_merge__cleanup(void)
34-
{
35-
}
36-
3728
void test_perf_merge__m1(void)
3829
{
39-
#if 1
40-
cl_skip();
41-
#else
4230
perf__do_merge(SRC_REPO, "m1", ID_BRANCH_A, ID_BRANCH_B);
43-
#endif
4431
}

tests/repo/open.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ void test_repo_open__from_git_new_workdir(void)
180180
cl_assert_(git__suffixcmp(git_repository_workdir(repo2), "alternate/") == 0, git_repository_workdir(repo2));
181181

182182
git_repository_free(repo2);
183+
#else
184+
cl_skip();
183185
#endif
184186
}
185187

0 commit comments

Comments
 (0)