mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 14:26:09 +03:00
Add tests
Also clean up build file name.
This commit is contained in:
parent
1a27580bb5
commit
13b799c6cd
@ -1,3 +1,6 @@
|
|||||||
|
branches:
|
||||||
|
except:
|
||||||
|
- dev
|
||||||
version: '{build}'
|
version: '{build}'
|
||||||
image: Visual Studio 2017
|
image: Visual Studio 2017
|
||||||
install:
|
install:
|
||||||
@ -11,17 +14,19 @@ build_script:
|
|||||||
- bash -c '~/.cargo/bin/sccache -s'
|
- bash -c '~/.cargo/bin/sccache -s'
|
||||||
- bash -c 'cd src; ./build.sh'
|
- bash -c 'cd src; ./build.sh'
|
||||||
- bash -c '~/.cargo/bin/sccache -s'
|
- bash -c '~/.cargo/bin/sccache -s'
|
||||||
- bash -c 'mkdir naive-$APPVEYOR_REPO_TAG_NAME-win64'
|
- ps: $env:BUILD_NAME="naiveproxy-$env:APPVEYOR_REPO_TAG_NAME-win64"
|
||||||
- bash -c 'cp src/out/Release/naive.exe src/config.json LICENSE naive-$APPVEYOR_REPO_TAG_NAME-win64/'
|
- bash -c 'mkdir $BUILD_NAME'
|
||||||
- bash -c '7z a naive-$APPVEYOR_REPO_TAG_NAME-win64.zip naive-$APPVEYOR_REPO_TAG_NAME-win64/'
|
- bash -c 'cp src/out/Release/naive.exe src/config.json LICENSE $BUILD_NAME'
|
||||||
test: off
|
- bash -c '7z a $BUILD_NAME.zip $BUILD_NAME'
|
||||||
|
test_script:
|
||||||
|
- bash -c './tests/basic.sh src/out/Release/naive'
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: naive-$(APPVEYOR_REPO_TAG_NAME)-win64.zip
|
- path: $(BUILD_NAME).zip
|
||||||
deploy:
|
deploy:
|
||||||
- provider: GitHub
|
- provider: GitHub
|
||||||
auth_token:
|
auth_token:
|
||||||
secure: h+qwIoof/3ET7LOldWwlb6XQLmpxYPuaZL4YcFQ8QyclfBrnywzwzDaSqdE2unPg
|
secure: h+qwIoof/3ET7LOldWwlb6XQLmpxYPuaZL4YcFQ8QyclfBrnywzwzDaSqdE2unPg
|
||||||
artifact: naive-$(APPVEYOR_REPO_TAG_NAME)-win64.zip
|
artifact: $(BUILD_NAME).zip
|
||||||
prerelease: true
|
prerelease: true
|
||||||
force_update: true
|
force_update: true
|
||||||
on:
|
on:
|
||||||
|
14
.travis.yml
14
.travis.yml
@ -1,3 +1,6 @@
|
|||||||
|
branches:
|
||||||
|
except:
|
||||||
|
- dev
|
||||||
language: cpp
|
language: cpp
|
||||||
os:
|
os:
|
||||||
- linux
|
- linux
|
||||||
@ -21,14 +24,17 @@ script:
|
|||||||
- ( cd src; ./get-clang.sh )
|
- ( cd src; ./get-clang.sh )
|
||||||
- ccache -s
|
- ccache -s
|
||||||
- ( cd src; ./build.sh )
|
- ( cd src; ./build.sh )
|
||||||
- mkdir naiveproxy-$TRAVIS_BRANCH-$TRAVIS_OS_NAME
|
- ccache -s
|
||||||
- cp src/out/Release/naive src/config.json LICENSE naiveproxy-$TRAVIS_BRANCH-$TRAVIS_OS_NAME/
|
- ./tests/basic.sh src/out/Release/naive
|
||||||
- tar cJf naiveproxy-$TRAVIS_BRANCH-$TRAVIS_OS_NAME.tar.xz naiveproxy-$TRAVIS_BRANCH-$TRAVIS_OS_NAME/
|
- export BUILD_NAME="naiveproxy-$TRAVIS_BRANCH-$TRAVIS_OS_NAME"
|
||||||
|
- mkdir $BUILD_NAME
|
||||||
|
- cp src/out/Release/naive src/config.json LICENSE $BUILD_NAME
|
||||||
|
- tar cJf $BUILD_NAME.tar.xz $BUILD_NAME
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
api_key:
|
api_key:
|
||||||
secure: hZ+M3GvNpPPMri0u7HkeDM8qCNSzCP2kBxL/68XgF3uvMDkJRX5/gyq27EoQMHyRxni759LlwHttRn6nHSg/CwNgK4fD4WPZWU99XIWKdlI+P1AQkHThjNtABv3P7JOq1HxyuwrcaBPybnDjsQTFE6HG5zsIhXZlUTCH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Hm3/OkqNyWllghc8DZnpAHh5AAYrrTIQPlSgtyqGL2qCoCPHbb2WgWewSVhqY+p7JMPchAc6myW3H2c7yL+TDMdRcr9I7DDOpvvfMoGx527Lji54mxGdZmdEpSGxi9Rx3g=
|
||||||
file: naiveproxy-$TRAVIS_BRANCH-$TRAVIS_OS_NAME.tar.xz
|
file: $BUILD_NAME.tar.xz
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
name: $TRAVIS_BRANCH
|
name: $TRAVIS_BRANCH
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
90
tests/basic.sh
Executable file
90
tests/basic.sh
Executable file
@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ "$1" ] || exit 1
|
||||||
|
naive="$1"
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
test_proxy() {
|
||||||
|
curl -v --proxy "$1" https://www.google.com/humans.txt | grep '^Google is built'
|
||||||
|
}
|
||||||
|
|
||||||
|
test_naive() {
|
||||||
|
test_name="$1"
|
||||||
|
proxy="$2"
|
||||||
|
echo "TEST '$test_name':"
|
||||||
|
shift 2
|
||||||
|
if (
|
||||||
|
trap 'kill $pid' EXIT
|
||||||
|
pid=
|
||||||
|
for arg in "$@"; do
|
||||||
|
$naive $arg & pid="$pid $!"
|
||||||
|
done
|
||||||
|
sleep 1
|
||||||
|
test_proxy "$proxy"
|
||||||
|
); then
|
||||||
|
echo "TEST '$test_name': PASS"
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "TEST '$test_name': FAIL"
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_naive 'Default config' socks5h://127.0.0.1:1080 '--log'
|
||||||
|
|
||||||
|
echo '{"listen":"socks://127.0.0.1:61080","log":""}' >config.json
|
||||||
|
test_naive 'Default config file' socks5h://127.0.0.1:61080 ''
|
||||||
|
rm -f config.json
|
||||||
|
|
||||||
|
echo '{"listen":"socks://127.0.0.1:61080","log":""}' >/tmp/config.json
|
||||||
|
test_naive 'Config file' socks5h://127.0.0.1:61080 '/tmp/config.json'
|
||||||
|
rm -f /tmp/config.json
|
||||||
|
|
||||||
|
test_naive 'Trivial - scheme only' socks5h://127.0.0.1:1080 \
|
||||||
|
'--log --listen=socks://'
|
||||||
|
|
||||||
|
test_naive 'Trivial - no host' socks5h://127.0.0.1:61080 \
|
||||||
|
'--log --listen=socks://:61080'
|
||||||
|
|
||||||
|
test_naive 'Trivial - no port' socks5h://127.0.0.1:1080 \
|
||||||
|
'--log --listen=socks://127.0.0.1'
|
||||||
|
|
||||||
|
test_naive 'SOCKS-SOCKS' socks5h://127.0.0.1:11080 \
|
||||||
|
'--log --listen=socks://:11080 --proxy=socks://127.0.0.1:21080' \
|
||||||
|
'--log --listen=socks://:21080'
|
||||||
|
|
||||||
|
test_naive 'SOCKS-HTTP' socks5h://127.0.0.1:11080 \
|
||||||
|
'--log --listen=socks://:11080 --proxy=http://127.0.0.1:28080' \
|
||||||
|
'--log --listen=http://:28080'
|
||||||
|
|
||||||
|
test_naive 'HTTP-HTTP' http://127.0.0.1:18080 \
|
||||||
|
'--log --listen=http://:18080 --proxy=http://127.0.0.1:28080' \
|
||||||
|
'--log --listen=http://:28080'
|
||||||
|
|
||||||
|
test_naive 'HTTP-SOCKS' http://127.0.0.1:18080 \
|
||||||
|
'--log --listen=http://:18080 --proxy=http://127.0.0.1:21080' \
|
||||||
|
'--log --listen=http://:21080'
|
||||||
|
|
||||||
|
test_naive 'SOCKS-HTTP padded' socks5h://127.0.0.1:11080 \
|
||||||
|
'--log --listen=socks://:11080 --proxy=http://127.0.01:28080 --padding' \
|
||||||
|
'--log --listen=http://:28080 --padding'
|
||||||
|
|
||||||
|
test_naive 'SOCKS-SOCKS-SOCKS' socks5h://127.0.0.1:11080 \
|
||||||
|
'--log --listen=socks://:11080 --proxy=socks://127.0.0.1:21080' \
|
||||||
|
'--log --listen=socks://:21080 --proxy=socks://127.0.0.1:31080' \
|
||||||
|
'--log --listen=socks://:31080'
|
||||||
|
|
||||||
|
test_naive 'SOCKS-HTTP-SOCKS' socks5h://127.0.0.1:11080 \
|
||||||
|
'--log --listen=socks://:11080 --proxy=socks://127.0.0.1:28080' \
|
||||||
|
'--log --listen=socks://:28080 --proxy=socks://127.0.0.1:31080' \
|
||||||
|
'--log --listen=socks://:31080'
|
||||||
|
|
||||||
|
test_naive 'HTTP-SOCKS-HTTP' socks5h://127.0.0.1:18080 \
|
||||||
|
'--log --listen=socks://:18080 --proxy=socks://127.0.0.1:21080' \
|
||||||
|
'--log --listen=socks://:21080 --proxy=socks://127.0.0.1:38080' \
|
||||||
|
'--log --listen=socks://:38080'
|
||||||
|
|
||||||
|
test_naive 'HTTP-HTTP-HTTP' socks5h://127.0.0.1:18080 \
|
||||||
|
'--log --listen=socks://:18080 --proxy=socks://127.0.0.1:28080' \
|
||||||
|
'--log --listen=socks://:28080 --proxy=socks://127.0.0.1:38080' \
|
||||||
|
'--log --listen=socks://:38080'
|
Loading…
Reference in New Issue
Block a user