Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
c4ded21e
Commit
c4ded21e
authored
Aug 14, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1774 from libgit2/test-ssh
Test SSH in travis
parents
89f6d84c
5be622fb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
15 deletions
+50
-15
.travis.yml
+5
-14
CMakeLists.txt
+3
-1
script/cibuild.sh
+32
-0
tests-clar/online/push.c
+10
-0
No files found.
.travis.yml
View file @
c4ded21e
# Travis-CI Build for libgit2
# see travis-ci.org for details
# As CMake is not officially supported we use erlang VMs
language
:
c
compiler
:
...
...
@@ -18,25 +17,17 @@ matrix:
-
compiler
:
i586-mingw32msvc-gcc
env
:
OPTIONS="-DBUILD_CLAR=OFF -DWIN32=ON -DMINGW=ON"
# Make sure CMake is installed
install
:
-
sudo apt-get
update >/dev/null
-
sudo apt-get -q
install cmake valgrind
-
sudo apt-get
-qq update
-
sudo apt-get -q
q install cmake libssh2-1-dev openssh-client openssh-server
# Run the Build script
# Run the Build script
and tests
script
:
-
mkdir _temp
-
git init --bare _temp/test.git
-
git daemon --listen=localhost --export-all --enable=receive-pack --base-path=_temp _temp 2>/dev/null &
-
export GITTEST_REMOTE_URL="git://localhost/test.git"
-
mkdir _build
-
cd _build
-
cmake .. -DCMAKE_INSTALL_PREFIX=../_install $OPTIONS
-
cmake --build . --target install
-
ctest -V .
-
script/cibuild.sh
# Run Tests
after_success
:
-
sudo apt-get -qq install valgrind
-
valgrind --leak-check=full --show-reachable=yes --suppressions=../libgit2_clar.supp ./libgit2_clar -ionline
# Only watch the development branch
...
...
CMakeLists.txt
View file @
c4ded21e
...
...
@@ -148,7 +148,9 @@ ELSE()
FILE
(
GLOB SRC_ZLIB deps/zlib/*.c deps/zlib/*.h
)
ENDIF
()
FIND_PACKAGE
(
LIBSSH2 QUIET
)
IF
(
NOT MINGW
)
FIND_PACKAGE
(
LIBSSH2 QUIET
)
ENDIF
()
IF
(
LIBSSH2_FOUND
)
ADD_DEFINITIONS
(
-DGIT_SSH
)
INCLUDE_DIRECTORIES
(
${
LIBSSH2_INCLUDE_DIR
}
)
...
...
script/cibuild.sh
0 → 100755
View file @
c4ded21e
#!/bin/sh
# Create a test repo which we can use for the online::push tests
mkdir
$HOME
/_temp
git init
--bare
$HOME
/_temp/test.git
git daemon
--listen
=
localhost
--export-all
--enable
=
receive-pack
--base-path
=
$HOME
/_temp
$HOME
/_temp 2>/dev/null &
export
GITTEST_REMOTE_URL
=
"git://localhost/test.git"
mkdir _build
cd
_build
cmake ..
-DCMAKE_INSTALL_PREFIX
=
../_install
$OPTIONS
cmake
--build
.
--target
install
ctest
-V
.
# Now that we've tested the raw git protocol, let's set up ssh to we
# can do the push tests over it
killall git-daemon
sudo
start ssh
ssh-keygen
-t
rsa
-f
~/.ssh/id_rsa
-N
""
-q
cat
~/.ssh/id_rsa.pub
>>
~/.ssh/authorized_keys
ssh-keyscan
-t
rsa localhost
>>
~/.ssh/known_hosts
export
GITTEST_REMOTE_URL
=
"ssh://localhost/
$HOME
/_temp/test.git"
export
GITTEST_REMOTE_USER
=
$USER
export
GITTEST_REMOTE_SSH_KEY
=
"
$HOME
/.ssh/id_rsa"
export
GITTEST_REMOTE_SSH_PUBKEY
=
"
$HOME
/.ssh/id_rsa.pub"
export
GITTEST_REMOTE_SSH_PASSPHRASE
=
""
if
[
-e
./libgit2_clar
]
;
then
./libgit2_clar
-sonline
::push
fi
tests-clar/online/push.c
View file @
c4ded21e
...
...
@@ -9,6 +9,10 @@
static
git_repository
*
_repo
;
static
char
*
_remote_ssh_key
;
static
char
*
_remote_ssh_pubkey
;
static
char
*
_remote_ssh_passphrase
;
static
char
*
_remote_url
;
static
char
*
_remote_user
;
static
char
*
_remote_pass
;
...
...
@@ -42,6 +46,9 @@ static int cred_acquire_cb(
*
((
bool
*
)
payload
)
=
true
;
if
(
GIT_CREDTYPE_SSH_PUBLICKEY
&
allowed_types
)
return
git_cred_ssh_keyfile_passphrase_new
(
cred
,
_remote_user
,
_remote_ssh_pubkey
,
_remote_ssh_key
,
_remote_ssh_passphrase
);
if
((
GIT_CREDTYPE_USERPASS_PLAINTEXT
&
allowed_types
)
==
0
||
git_cred_userpass_plaintext_new
(
cred
,
_remote_user
,
_remote_pass
)
<
0
)
return
-
1
;
...
...
@@ -277,6 +284,9 @@ void test_online_push__initialize(void)
_remote_url
=
cl_getenv
(
"GITTEST_REMOTE_URL"
);
_remote_user
=
cl_getenv
(
"GITTEST_REMOTE_USER"
);
_remote_pass
=
cl_getenv
(
"GITTEST_REMOTE_PASS"
);
_remote_ssh_key
=
cl_getenv
(
"GITTEST_REMOTE_SSH_KEY"
);
_remote_ssh_pubkey
=
cl_getenv
(
"GITTEST_REMOTE_SSH_PUBKEY"
);
_remote_ssh_passphrase
=
cl_getenv
(
"GITTEST_REMOTE_SSH_PASSPHRASE"
);
_remote
=
NULL
;
if
(
_remote_url
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment