mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 06:16:30 +03:00
Add continuous integration and tests
This commit is contained in:
parent
54025411d9
commit
99f284a4b0
35
.appveyor.yml
Normal file
35
.appveyor.yml
Normal file
@ -0,0 +1,35 @@
|
||||
branches:
|
||||
except:
|
||||
- dev
|
||||
version: '{build}'
|
||||
platform:
|
||||
- x64
|
||||
- x86
|
||||
image: Visual Studio 2019
|
||||
install:
|
||||
- cinst ninja
|
||||
cache:
|
||||
- '%LOCALAPPDATA%\Mozilla\sccache'
|
||||
build_script:
|
||||
- bash ./tools/import-upstream.sh
|
||||
- bash -c 'cd src; ./get-clang.sh'
|
||||
- bash -c '~/.cargo/bin/sccache -s'
|
||||
- bash -c 'cd src; EXTRA_FLAGS=target_cpu=\"$Platform\" ./build.sh'
|
||||
- bash -c '~/.cargo/bin/sccache -s'
|
||||
- ps: $env:BUILD_NAME="naiveproxy-$env:APPVEYOR_REPO_TAG_NAME-win-$env:PLATFORM"
|
||||
- bash -c 'mkdir $BUILD_NAME'
|
||||
- bash -c 'cp src/out/Release/naive.exe src/config.json LICENSE USAGE.txt $BUILD_NAME'
|
||||
- bash -c '7z a $BUILD_NAME.zip $BUILD_NAME'
|
||||
test_script:
|
||||
- bash -c './tests/basic.sh src/out/Release/naive'
|
||||
artifacts:
|
||||
- path: $(BUILD_NAME).zip
|
||||
deploy:
|
||||
- provider: GitHub
|
||||
auth_token:
|
||||
secure: h+qwIoof/3ET7LOldWwlb6XQLmpxYPuaZL4YcFQ8QyclfBrnywzwzDaSqdE2unPg
|
||||
artifact: $(BUILD_NAME).zip
|
||||
prerelease: true
|
||||
force_update: true
|
||||
on:
|
||||
APPVEYOR_REPO_TAG: true
|
107
.travis.yml
Normal file
107
.travis.yml
Normal file
@ -0,0 +1,107 @@
|
||||
branches:
|
||||
except:
|
||||
- dev
|
||||
language: cpp
|
||||
matrix:
|
||||
include:
|
||||
- name: "linux-x64"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='target_cpu="x64"'
|
||||
- name: "linux-x86"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='target_cpu="x86"'
|
||||
- name: "linux-arm64"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='target_cpu="arm64"'
|
||||
- name: "linux-arm"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='target_cpu="arm"'
|
||||
- name: "openwrt-mipsel_24kc"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='
|
||||
target_cpu="mipsel"
|
||||
mips_arch_variant="r2" mips_float_abi="soft" mips_tune="24kc"
|
||||
use_allocator="none" use_allocator_shim=false
|
||||
use_lld=false use_gold=false
|
||||
ldso_path="/lib/ld-musl-mipsel-sf.so.1"
|
||||
custom_toolchain="//build/toolchain/linux:clang_mipsel_openwrt"'
|
||||
OPENWRT_FLAGS='arch=mipsel_24kc release=19.07.3 gcc_ver=7.5.0 target=ramips subtarget=rt305x abi=musl'
|
||||
- name: "openwrt-x86_64"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='
|
||||
target_cpu="x64"
|
||||
use_allocator="none" use_allocator_shim=false
|
||||
custom_toolchain="//build/toolchain/linux:clang_x64_openwrt"'
|
||||
OPENWRT_FLAGS='arch=x86_64 release=19.07.3 gcc_ver=7.5.0 target=x86 subtarget=64 abi=musl'
|
||||
- name: "openwrt-arm64"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='
|
||||
target_cpu="arm64"
|
||||
use_allocator="none" use_allocator_shim=false
|
||||
custom_toolchain="//build/toolchain/linux:clang_arm64_openwrt"'
|
||||
OPENWRT_FLAGS='arch=aarch64 release=19.07.3 gcc_ver=7.5.0 target=armvirt subtarget=64 abi=musl'
|
||||
- name: "openwrt-arm_cortex-a15_neon-vfpv4"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='
|
||||
target_cpu="arm"
|
||||
arm_version=0 arm_cpu="cortex-a15" arm_fpu="neon-vfpv4" arm_float_abi="hard"
|
||||
use_allocator="none" use_allocator_shim=false
|
||||
custom_toolchain="//build/toolchain/linux:clang_arm_openwrt"'
|
||||
OPENWRT_FLAGS='arch=arm_cortex-a15_neon-vfpv4 release=19.07.3 gcc_ver=7.5.0 target=ipq806x subtarget=generic abi=musl_eabi'
|
||||
- name: "openwrt-arm_cortex-a9"
|
||||
os: linux
|
||||
dist: bionic
|
||||
env: EXTRA_FLAGS='
|
||||
target_cpu="arm"
|
||||
arm_version=0 arm_cpu="cortex-a9" arm_float_abi="soft" arm_use_neon=false
|
||||
use_allocator="none" use_allocator_shim=false
|
||||
custom_toolchain="//build/toolchain/linux:clang_arm_openwrt"'
|
||||
OPENWRT_FLAGS='arch=arm_cortex-a9 release=19.07.3 gcc_ver=7.5.0 target=bcm53xx subtarget=generic abi=musl_eabi'
|
||||
- name: "osx"
|
||||
os: osx
|
||||
osx_image: xcode11.3
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- ninja-build
|
||||
- pkg-config
|
||||
- libnss3-dev
|
||||
- qemu-user
|
||||
homebrew:
|
||||
packages:
|
||||
- ninja
|
||||
- ccache
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.ccache
|
||||
- src/out/sysroot-build/openwrt
|
||||
script:
|
||||
- ./tools/import-upstream.sh
|
||||
- ( cd src; ./get-clang.sh )
|
||||
- ccache -s
|
||||
- ( cd src; ./build.sh )
|
||||
- ccache -s
|
||||
- ./tests/basic.sh src/out/Release/naive
|
||||
- export BUILD_NAME="naiveproxy-$TRAVIS_BRANCH-$TRAVIS_JOB_NAME"
|
||||
- mkdir $BUILD_NAME
|
||||
- cp src/out/Release/naive src/config.json LICENSE USAGE.txt $BUILD_NAME
|
||||
- tar cJf $BUILD_NAME.tar.xz $BUILD_NAME
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: hZ+M3GvNpPPMri0u7HkeDM8qCNSzCP2kBxL/68XgF3uvMDkJRX5/gyq27EoQMHyRxni759LlwHttRn6nHSg/CwNgK4fD4WPZWU99XIWKdlI+P1AQkHThjNtABv3P7JOq1HxyuwrcaBPybnDjsQTFE6HG5zsIhXZlUTCHbndCBpYPuDnaqKJJUv4/WzoEjXAlBSkAsBGhEQv+HZhaupw5vSkDkulNgXZrXOoO6uzAtAiR5St38dV7cWXgk6UwoyrVaV8cO0cltveyEPkGYMXJh6YkopJjSVrkYlI8vWsA8CgwdhXwAkYoG1uaIDUdNdlrBXNuA0BOFcU3iEo3D9H/z1/WQUnCuAOVCkYC/QhkTCsioQ5vaNA56+3uY8KOSDNo8XxxBzRIUSwul2lwHCNl6+cf1EhO9brI3Q8q/ZPZLmNIqYDXAI29/MMC13g/ql8UUcy2TwGrx2OE73SIzVBm2hVYI6FFs2hjJzMkknV83K0kr515gXrI+p7ANqnA9vdRBx7zMdOT1etFeuD06wjbLGLmHTS4ykhDYl6wn26fJHm3/OkqNyWllghc8DZnpAHh5AAYrrTIQPlSgtyqGL2qCoCPHbb2WgWewSVhqY+p7JMPchAc6myW3H2c7yL+TDMdRcr9I7DDOpvvfMoGx527Lji54mxGdZmdEpSGxi9Rx3g=
|
||||
file: $BUILD_NAME.tar.xz
|
||||
skip_cleanup: true
|
||||
name: $TRAVIS_BRANCH
|
||||
prerelease: true
|
||||
on:
|
||||
tags: true
|
||||
all_branches: true
|
107
tests/basic.sh
Executable file
107
tests/basic.sh
Executable file
@ -0,0 +1,107 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$1" ] || exit 1
|
||||
naive="$1"
|
||||
if [ "$(uname)" = Linux ]; then
|
||||
. src/get-sysroot.sh
|
||||
sysroot=$(get_sysroot)
|
||||
eval "$EXTRA_FLAGS"
|
||||
case "$target_cpu" in
|
||||
arm64) naive="qemu-aarch64 -L src/$sysroot $naive";;
|
||||
arm) naive="qemu-arm -L src/$sysroot $naive";;
|
||||
x64) naive="qemu-x86_64 -L src/$sysroot $naive";;
|
||||
x86) naive="qemu-i386 -L src/$sysroot $naive";;
|
||||
mipsel) naive="qemu-mipsel -L src/$sysroot $naive";;
|
||||
esac
|
||||
fi
|
||||
|
||||
set -ex
|
||||
|
||||
test_proxy() {
|
||||
curl -v --proxy "$1" https://www.microsoft.com/robots.txt | grep 'www.microsoft.com'
|
||||
}
|
||||
|
||||
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:60101","log":""}' >config.json
|
||||
test_naive 'Default config file' socks5h://127.0.0.1:60101 ''
|
||||
rm -f config.json
|
||||
|
||||
echo '{"listen":"socks://127.0.0.1:60201","log":""}' >/tmp/config.json
|
||||
test_naive 'Config file' socks5h://127.0.0.1:60201 '/tmp/config.json'
|
||||
rm -f /tmp/config.json
|
||||
|
||||
test_naive 'Trivial - listen scheme only' socks5h://127.0.0.1:1080 \
|
||||
'--log --listen=socks://'
|
||||
|
||||
test_naive 'Trivial - listen no host' socks5h://127.0.0.1:60301 \
|
||||
'--log --listen=socks://:60301'
|
||||
|
||||
test_naive 'Trivial - listen no port' socks5h://127.0.0.1:1080 \
|
||||
'--log --listen=socks://127.0.0.1'
|
||||
|
||||
test_naive 'SOCKS-SOCKS' socks5h://127.0.0.1:60401 \
|
||||
'--log --listen=socks://:60401 --proxy=socks://127.0.0.1:60402' \
|
||||
'--log --listen=socks://:60402'
|
||||
|
||||
test_naive 'SOCKS-SOCKS - proxy no port' socks5h://127.0.0.1:60501 \
|
||||
'--log --listen=socks://:60501 --proxy=socks://127.0.0.1' \
|
||||
'--log --listen=socks://:1080'
|
||||
|
||||
test_naive 'SOCKS-HTTP' socks5h://127.0.0.1:60601 \
|
||||
'--log --listen=socks://:60601 --proxy=http://127.0.0.1:60602' \
|
||||
'--log --listen=http://:60602'
|
||||
|
||||
test_naive 'HTTP-HTTP' http://127.0.0.1:60701 \
|
||||
'--log --listen=http://:60701 --proxy=http://127.0.0.1:60702' \
|
||||
'--log --listen=http://:60702'
|
||||
|
||||
test_naive 'HTTP-SOCKS' http://127.0.0.1:60801 \
|
||||
'--log --listen=http://:60801 --proxy=socks://127.0.0.1:60802' \
|
||||
'--log --listen=socks://:60802'
|
||||
|
||||
test_naive 'SOCKS-HTTP padded' socks5h://127.0.0.1:60901 \
|
||||
'--log --listen=socks://:60901 --proxy=http://127.0.0.1:60902 --padding' \
|
||||
'--log --listen=http://:60902 --padding'
|
||||
|
||||
test_naive 'SOCKS-SOCKS-SOCKS' socks5h://127.0.0.1:61001 \
|
||||
'--log --listen=socks://:61001 --proxy=socks://127.0.0.1:61002' \
|
||||
'--log --listen=socks://:61002 --proxy=socks://127.0.0.1:61003' \
|
||||
'--log --listen=socks://:61003'
|
||||
|
||||
test_naive 'SOCKS-HTTP-SOCKS' socks5h://127.0.0.1:61101 \
|
||||
'--log --listen=socks://:61101 --proxy=http://127.0.0.1:61102' \
|
||||
'--log --listen=http://:61102 --proxy=socks://127.0.0.1:61103' \
|
||||
'--log --listen=socks://:61103'
|
||||
|
||||
test_naive 'HTTP-SOCKS-HTTP' http://127.0.0.1:61201 \
|
||||
'--log --listen=http://:61201 --proxy=socks://127.0.0.1:61202' \
|
||||
'--log --listen=socks://:61202 --proxy=http://127.0.0.1:61203' \
|
||||
'--log --listen=http://:61203'
|
||||
|
||||
test_naive 'HTTP-HTTP-HTTP' http://127.0.0.1:61301 \
|
||||
'--log --listen=http://:61301 --proxy=http://127.0.0.1:61302' \
|
||||
'--log --listen=http://:61302 --proxy=http://127.0.0.1:61303' \
|
||||
'--log --listen=http://:61303'
|
Loading…
Reference in New Issue
Block a user