Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
fix travis
Browse files Browse the repository at this point in the history
  • Loading branch information
n0rad committed Nov 28, 2016
1 parent f7aaded commit ca51507
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 34 deletions.
13 changes: 8 additions & 5 deletions gomake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -e
: ${upx:=}
: ${build_packages:=}
: ${build_ldflags:="-s -w -X main.BuildTime=`date -u '+%Y-%m-%d_%H:%M:%S_UTC'` -X main.BuildVersion=\${version} -X main.BuildCommit=`git rev-parse --short HEAD`"}
: ${errcheck:=1}

read -d '' helper <<EOF || true
Usage: gomake [-v version][-t token] command...
Expand Down Expand Up @@ -141,11 +142,13 @@ quality() {
echo_green "Fix"
go tool fix ${go_files}

echo_green "Err check"
[ -f ${GOPATH}/bin/errcheck ] || go get -u github.com/kisielk/errcheck
res=$(errcheck ./... | grep -v 'vendor/' | grep -v 'Close(' | grep -v '_test.go')
err_count "${res}"
echo_red "${res}"
if [ ${errcheck} == 1 ]; then
echo_green "Err check"
[ -f ${GOPATH}/bin/errcheck ] || go get -u github.com/kisielk/errcheck
res=$(errcheck ./... | grep -v 'vendor/' | grep -v 'Close(' | grep -v '_test.go')
err_count "${res}"
echo_red "${res}"
fi

echo_green "Lint"
[ -f ${GOPATH}/bin/golint ] || go get -u github.com/golang/lint/golint
Expand Down
31 changes: 2 additions & 29 deletions gomake.cfg
Original file line number Diff line number Diff line change
@@ -1,40 +1,13 @@
build_packages=${work_path}/dgr
errcheck=0

pre-build() {
[ -f ${work_path}/${target_name}/templater ] || ${work_path}/bin-templater/build.sh
[ -f ${work_path}/${target_name}/bindata/aci-tester.aci ] || ${work_path}/aci-tester/build.sh
[ -f ${work_path}/${target_name}/bindata/aci-builder.aci ] || ${work_path}/aci-builder/build.sh
}

execute_tests() {
fdir=$1
[ -d "$fdir" ] || return 0

for file in $fdir/*; do
filename=$(basename $file)
[ "$filename" == "wait.sh" ] && continue
[ -d "$file" ] && continue

echo -e "\e[1m\e[32mRunning test file -> $filename\e[0m"
bats -p $file
done
}

test() {
if [ "$(id -u)" != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi


#templater
${work_path}/bin-templater/tests.sh

#dgr
command -v rkt >/dev/null 2>&1 || { echo >&2 "rkt not found in path"; exit 1; }
command -v bats >/dev/null 2>&1 || { echo >&2 "bats not found in path"; exit 1; }
export DGR_PATH="../${work_path}/${target_name}/$(targetBinaryPath ${osarchi})"
cd "${work_path}/tests"
execute_tests "."

sudo DGR_PATH="../${work_path}/${target_name}/$(targetBinaryPath ${osarchi})" ${work_path}/tests/test.sh
}
Empty file modified scripts/glide-install.sh
100644 → 100755
Empty file.
29 changes: 29 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -x

if [ "$(id -u)" != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi

execute_tests() {
fdir=$1
[ -d "$fdir" ] || return 0

for file in $fdir/*; do
filename=$(basename $file)
[ "$filename" == "wait.sh" ] && continue
[ -d "$file" ] && continue
[ "$filename" == "test.sh" ] && continue

echo -e "\e[1m\e[32mRunning test file -> $filename\e[0m"
bats -p $file
done
}

#dgr
command -v rkt >/dev/null 2>&1 || { echo >&2 "rkt not found in path"; exit 1; }
command -v bats >/dev/null 2>&1 || { echo >&2 "bats not found in path"; exit 1; }
dir=$( dirname $0 )
cd ${dir}
execute_tests "."

0 comments on commit ca51507

Please sign in to comment.