Merge remote-tracking branch 'mroth/osx-testing' into osx-testing
This commit is contained in:
17
.travis.yml
17
.travis.yml
@@ -1,3 +1,16 @@
|
|||||||
script: ./run_tests.sh
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
|
||||||
|
env:
|
||||||
|
- TEST_SHELLS=bash
|
||||||
|
- TEST_SHELLS=zsh
|
||||||
|
|
||||||
|
install:
|
||||||
|
- ./test/support/travisci_deps.sh
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- sudo apt-get install zsh
|
- echo -e "test_repo_11\ntest_repo_1" | sort
|
||||||
|
|
||||||
|
script:
|
||||||
|
- ./run_tests.sh
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
# Add ignore rule to .git/info/exclude if not already present
|
# Add ignore rule to .git/info/exclude if not already present
|
||||||
_design_add_git_exclude(){
|
_design_add_git_exclude(){
|
||||||
local git_dir="$(cd $1 && readlink -m $(git rev-parse --git-dir))"
|
local git_dir="$(cd $1 && cd `git rev-parse --git-dir` && pwd -P)"
|
||||||
if [ -e "$git_dir/info/exclude" ] && ! $(grep -q "$project_design_dir" "$git_dir/info/exclude"); then
|
if [ -e "$git_dir/info/exclude" ] && ! $(grep -q "$project_design_dir" "$git_dir/info/exclude"); then
|
||||||
echo "$project_design_dir" >> "$git_dir/info/exclude"
|
echo "$project_design_dir" >> "$git_dir/info/exclude"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -3,8 +3,15 @@
|
|||||||
|
|
||||||
failed=false
|
failed=false
|
||||||
|
|
||||||
|
# allow list of shells to run tests in to be overriden by environment variable
|
||||||
|
# if empty or null, use defaults
|
||||||
|
if [ -z "$TEST_SHELLS" ]; then
|
||||||
|
TEST_SHELLS="bash zsh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "== Will run all tests with following shells: ${TEST_SHELLS}"
|
||||||
for test in $(find test/lib -name *_test.sh); do
|
for test in $(find test/lib -name *_test.sh); do
|
||||||
for shell in bash zsh; do
|
for shell in $TEST_SHELLS; do
|
||||||
echo "== Running tests with [$shell]: $test"
|
echo "== Running tests with [$shell]: $test"
|
||||||
$shell $test || failed=true
|
$shell $test || failed=true
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -32,11 +32,15 @@ oneTimeSetUp() {
|
|||||||
|
|
||||||
# Test functions
|
# Test functions
|
||||||
function ln() { ln $@; }
|
function ln() { ln $@; }
|
||||||
# Test aliases
|
|
||||||
|
# Before aliasing, get original locations so we can compare them in the test
|
||||||
|
unalias mv rm sed cat 2>/dev/null
|
||||||
export mv_path="$(which mv)"
|
export mv_path="$(which mv)"
|
||||||
export rm_path="$(which rm)"
|
export rm_path="$(which rm)"
|
||||||
export sed_path="$(which sed)"
|
export sed_path="$(which sed)"
|
||||||
export cat_pathj="$(which cat)"
|
export cat_path="$(which cat)"
|
||||||
|
|
||||||
|
# Test aliases
|
||||||
alias mv="nocorrect $mv_path"
|
alias mv="nocorrect $mv_path"
|
||||||
alias rm="$rm_path --option"
|
alias rm="$rm_path --option"
|
||||||
alias sed="$sed_path"
|
alias sed="$sed_path"
|
||||||
@@ -76,7 +80,15 @@ test_ls_with_file_shortcuts() {
|
|||||||
export git_env_char="e"
|
export git_env_char="e"
|
||||||
|
|
||||||
TEST_DIR=$(mktemp -d -t scm_breeze.XXXXXXXXXX)
|
TEST_DIR=$(mktemp -d -t scm_breeze.XXXXXXXXXX)
|
||||||
|
|
||||||
|
# Darwin actually symlinks /var inside /private, but mktemp reports back the
|
||||||
|
# logical pathat time of file creation. So make sure we always get the
|
||||||
|
# full physical path to be absolutely certain when doing comparisons later,
|
||||||
|
# because thats how the Ruby status_shortcuts.rb script is going to obtain
|
||||||
|
# them.
|
||||||
cd $TEST_DIR
|
cd $TEST_DIR
|
||||||
|
TEST_DIR=$(pwd -P)
|
||||||
|
|
||||||
touch 'test file' 'test_file'
|
touch 'test file' 'test_file'
|
||||||
mkdir -p "a [b]" 'a "b"' "a 'b'"
|
mkdir -p "a [b]" 'a "b"' "a 'b'"
|
||||||
touch "a \"b\"/c"
|
touch "a \"b\"/c"
|
||||||
@@ -87,7 +99,7 @@ test_ls_with_file_shortcuts() {
|
|||||||
ls_with_file_shortcuts > $temp_file
|
ls_with_file_shortcuts > $temp_file
|
||||||
ls_output=$(<$temp_file strip_colors)
|
ls_output=$(<$temp_file strip_colors)
|
||||||
|
|
||||||
# Compare as fixed strings (F), instead of regex (P)
|
# Compare as fixed strings (F), instead of normal grep behavior
|
||||||
assertIncludes "$ls_output" '[1] a "b"' F
|
assertIncludes "$ls_output" '[1] a "b"' F
|
||||||
assertIncludes "$ls_output" "[2] a 'b'" F
|
assertIncludes "$ls_output" "[2] a 'b'" F
|
||||||
assertIncludes "$ls_output" '[3] a [b]' F
|
assertIncludes "$ls_output" '[3] a [b]' F
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ oneTimeSetUp() {
|
|||||||
export ga_auto_remove="yes"
|
export ga_auto_remove="yes"
|
||||||
|
|
||||||
testRepo=$(mktemp -d -t scm_breeze.XXXXXXXXXX)
|
testRepo=$(mktemp -d -t scm_breeze.XXXXXXXXXX)
|
||||||
|
testRepo=$(cd $testRepo && pwd -P)
|
||||||
}
|
}
|
||||||
|
|
||||||
oneTimeTearDown() {
|
oneTimeTearDown() {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ fi
|
|||||||
|
|
||||||
# Strip color codes from a string
|
# Strip color codes from a string
|
||||||
strip_colors() {
|
strip_colors() {
|
||||||
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
|
perl -pe 's/\e\[[\d;]*m//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print space separated tab completion options
|
# Print space separated tab completion options
|
||||||
@@ -34,7 +34,7 @@ verboseGitCommands() {
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
_includes() {
|
_includes() {
|
||||||
if [ -n "$3" ]; then regex="$3"; else regex=P; fi
|
if [ -n "$3" ]; then regex="$3"; else regex=''; fi
|
||||||
if echo "$1" | grep -q$regex "$2"; then echo 0; else echo 1; fi
|
if echo "$1" | grep -q$regex "$2"; then echo 0; else echo 1; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,4 +46,3 @@ assertIncludes() {
|
|||||||
assertNotIncludes() {
|
assertNotIncludes() {
|
||||||
assertFalse "'$1' should not have contained '$2'" $(_includes "$@")
|
assertFalse "'$1' should not have contained '$2'" $(_includes "$@")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
32
test/support/travisci_deps.sh
Executable file
32
test/support/travisci_deps.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Installs dependencies for travis-ci environments.
|
||||||
|
|
||||||
|
# Install dependencies, which looks to be just bash & zsh.
|
||||||
|
#
|
||||||
|
# Darwin has zsh preinstalled already, so only need to install on Ubuntu.
|
||||||
|
#
|
||||||
|
# Note: $TRAVIS_OS_NAME will only be set on text boxes with multi-os enabled,
|
||||||
|
# so use negation test so it will fail gracefully on normal Travis linux setup.
|
||||||
|
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then
|
||||||
|
|
||||||
|
# okay, so we know we're probably on a linux box (or at least not an osx box)
|
||||||
|
# at this point. do we need to install zsh? let's say the default case is no:
|
||||||
|
needs_zsh=false
|
||||||
|
|
||||||
|
# check if zsh is listed in the TEST_SHELLS environment variable, set by
|
||||||
|
# our travis-ci build matrix.
|
||||||
|
if [[ $TEST_SHELLS =~ zsh ]]; then needs_zsh=true; fi
|
||||||
|
|
||||||
|
# if there is NO $TEST_SHELLS env variable persent (which should never happen,
|
||||||
|
# but maybe someone has been monkeying with the .travis.yml), run_tests.sh is
|
||||||
|
# going to fall back onto the default of testing everything, so we need zsh.
|
||||||
|
if [[ -z "$TEST_SHELLS" ]]; then needs_zsh=true; fi
|
||||||
|
|
||||||
|
# finally, we install zsh if needed!
|
||||||
|
if $needs_zsh ; then
|
||||||
|
sudo apt-get install zsh
|
||||||
|
else
|
||||||
|
echo "No deps required."
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user