From fefbd02dbbd209103811f36e61d57229432eed09 Mon Sep 17 00:00:00 2001 From: DC* Date: Sat, 17 Dec 2016 22:18:59 +0200 Subject: [PATCH] Configure Travis-Ci to build against OS X (10.11, xcode 7.3) (#365) Build zsh versions: master, 5.3, 5.2, 5.1, 5.0.0, 4.3.17, 4.3.5 (4.3.5 only linux) --- .gitignore | 2 +- .travis.yml | 71 +++++++++++++++++++++++++++++++++++++--------- Makefile | 2 +- tests/.zshenv | 13 +++++++++ tests/build-zsh.sh | 2 +- tests/bundle.t | 4 +-- tests/cache.t | 10 +++---- tests/stats.sh | 9 +++--- 8 files changed, 85 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index b1bcfdb4..ef44a9a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Running tests creates this completion dump file. -tests/.zcompdump +tests/.zcompdump* # Test failure reports tests/*.t.err diff --git a/.travis.yml b/.travis.yml index 50d70da1..95cddddd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ -# Using python for running the tests, using the `cram` test framework. -language: python +sudo: false # Python version to run tests with. python: @@ -20,14 +19,53 @@ env: - ZSH_REMOTE_URL=https://github.com/zsh-users/zsh.git - BUILDS_PATH=$HOME/.zsh-builds - ZSH_SOURCE=$HOME/zsh - matrix: - - ZSH_BUILD_VERSION=master - - ZSH_BUILD_VERSION=zsh-5.3 - - ZSH_BUILD_VERSION=zsh-5.2 - - ZSH_BUILD_VERSION=zsh-5.1 - - ZSH_BUILD_VERSION=zsh-5.0.0 - - ZSH_BUILD_VERSION=zsh-4.3.17 - - ZSH_BUILD_VERSION=zsh-4.3.5 + +matrix: + include: + - os: linux + language: python + env: ZSH_BUILD_VERSION=master + - os: linux + language: python + env: ZSH_BUILD_VERSION=zsh-5.3 + - os: linux + language: python + env: ZSH_BUILD_VERSION=zsh-5.2 + - os: linux + language: python + env: ZSH_BUILD_VERSION=zsh-5.1 + - os: linux + language: python + env: ZSH_BUILD_VERSION=zsh-5.0.0 + - os: linux + language: python + env: ZSH_BUILD_VERSION=zsh-4.3.17 + - os: linux + language: python + env: ZSH_BUILD_VERSION=zsh-4.3.5 + + - os: osx + language: generic + env: ZSH_BUILD_VERSION=master + - os: osx + language: generic + env: ZSH_BUILD_VERSION=zsh-5.3 + - os: osx + language: generic + env: ZSH_BUILD_VERSION=zsh-5.2 + - os: osx + language: generic + env: ZSH_BUILD_VERSION=zsh-5.1 + - os: osx + language: generic + env: ZSH_BUILD_VERSION=zsh-5.0.0 + - os: osx + language: generic + env: ZSH_BUILD_VERSION=zsh-4.3.17 + # zsh 4.3.5 fails on OS X. See https://travis-ci.org/zsh-users/antigen/jobs/184819719 + #- os: osx + #language: generic + #env: ZSH_BUILD_VERSION=zsh-4.3.5 install: # Install python requirements. @@ -36,20 +74,25 @@ install: # Install zsh versions from source. - "./tests/build-zsh.sh $ZSH_BUILD_VERSION $BUILDS_PATH $ZSH_SOURCE" -before_script: +before_install: + # Show system information + - "uname -a" + # Show the git version being used to test. - "git --version" +before_script: + # Show zsh version being deployed. + - "$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh --version" + # Test config for git. - "git config --global user.name test" - "git config --global user.email test@test.test" - # Show zsh version being deployed. - - "$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh --version" - # Run the tests. script: - "make tests PYENV= SHELL=$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh" - "make stats _ANTIGEN_CACHE_ENABLED=false _ANTIGEN_INIT_ENABLED=false SHELL=$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh" - "make stats _ANTIGEN_CACHE_ENABLED=true _ANTIGEN_INIT_ENABLED=false SHELL=$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh" - "make stats _ANTIGEN_CACHE_ENABLED=true _ANTIGEN_INIT_ENABLED=true SHELL=$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh" + diff --git a/Makefile b/Makefile index 1d239856..5be38505 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,6 @@ deps: pip install cram==0.6.* stats: - ${PROJECT}/tests/stats.sh "${PROJECT}" "${SHELL}" + "${SHELL}" ${PROJECT}/tests/stats.sh "${PROJECT}" "${SHELL}" all: clean build install diff --git a/tests/.zshenv b/tests/.zshenv index 23740e18..b2d811de 100644 --- a/tests/.zshenv +++ b/tests/.zshenv @@ -51,3 +51,16 @@ echo 'alias unsourced-alias="echo unsourced-alias"' > "$PLUGIN_DIR2"/aliases.zsh pg2 add . pg2 commit -m 'Initial commit' } > /dev/null + +# Wrapper around \wc command to handle wc format differences between GNU and BSD +# GNU: +# echo 1 | wc -l +# 1 +# BSD: +# echo 1 | wc -l +# 1 +# +# Using this wrapper output from both implementations resembles GNU's. +function wc () { + command wc "$@" | xargs +} diff --git a/tests/build-zsh.sh b/tests/build-zsh.sh index 88ccf9c3..13726d4f 100755 --- a/tests/build-zsh.sh +++ b/tests/build-zsh.sh @@ -43,7 +43,7 @@ git checkout $ZSH_VERSION ./Util/preconfig # Configure bindir for this branch -./configure --bindir=$BUILDS_PATH/$ZSH_VERSION --prefix=$BUILDS_PATH/$ZSH_VERSION +./configure --bindir=$BUILDS_PATH/$ZSH_VERSION --prefix=$BUILDS_PATH/$ZSH_VERSION --without-tcsetpgrp # Make make -j5 diff --git a/tests/bundle.t b/tests/bundle.t index 963d683e..58372fe4 100644 --- a/tests/bundle.t +++ b/tests/bundle.t @@ -27,7 +27,7 @@ Try to install an unexisting bundle. $ antigen-bundle https://127.0.0.1/bundle/unexisting.git Installing bundle/unexisting... Error! See * (glob) [1] - $ echo $fpath | grep -Pco test-plugin + $ echo $fpath | grep -co test-plugin 1 Confirm there is still only one repository. @@ -50,7 +50,7 @@ The alias defined in the other zsh file should not be available. Fpath should be updated correctly. - $ echo ${(j:\n:)fpath} | grep -Pco test-plugin + $ echo ${(j:\n:)fpath} | grep -co test-plugin 2 Load plugin multiple times, doesn't cluters _ANTIGEN_BUNDLE_RECORD diff --git a/tests/cache.t b/tests/cache.t index 4719ef94..ba9f3455 100644 --- a/tests/cache.t +++ b/tests/cache.t @@ -61,13 +61,13 @@ Cache is saved correctly. $ cat $_ZCACHE_PAYLOAD_PATH | wc -l 24 - $ cat $_ZCACHE_PAYLOAD_PATH | grep -Pzc 'hehe2"\nalias prompt' + $ cat $_ZCACHE_PAYLOAD_PATH | grep -c 'alias prompt' 1 - $ cat $_ZCACHE_PAYLOAD_PATH | grep -Pc 'root=\${__ZCACHE_FILE_PATH}' + $ cat $_ZCACHE_PAYLOAD_PATH | grep -c 'root=\${__ZCACHE_FILE_PATH}' 1 - $ cat $_ZCACHE_PAYLOAD_PATH | grep -Pc 'echo \$root/\$0' + $ cat $_ZCACHE_PAYLOAD_PATH | grep -c 'echo \$root/\$0' 1 Cache is invalidated on antigen configuration changes. @@ -95,8 +95,8 @@ Cache is invalidated on antigen configuration changes. Cache version matches antigen version. $ ANTIGEN_VERSION=$(antigen version | sed 's/Antigen //') - $ cat $_ZCACHE_PAYLOAD_PATH | grep -Pzc "$ANTIGEN_VERSION" - 1 + $ cat $_ZCACHE_PAYLOAD_PATH | grep -c "$ANTIGEN_VERSION" + 2 $ if [[ "$ANTIGEN_VERSION" == "$_ZCACHE_CACHE_VERSION" ]]; then echo 1; else echo 0; fi 1 diff --git a/tests/stats.sh b/tests/stats.sh index c4afd747..27e8aae9 100755 --- a/tests/stats.sh +++ b/tests/stats.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/zsh PROJECT=${1:-$HOME} SHELL=${2:-zsh} ZSHRC=$HOME/.zshrc @@ -11,12 +11,13 @@ cp $ZSHRC $TMP cp $PROJECT/tests/.zshrc $HOME/.zshrc eval $CMD + for x in $(seq 1 20); do - /usr/bin/time -f "real %e user %U sys %S" -a -o $MTIME $CMD + (eval time $CMD) &>> $MTIME tail -1 $MTIME -done +done -awk '{ et += $2; ut += $4; st += $6; count++ } END { printf "\nAverage:\nreal %.3f user %.3f sys %.3f\n", et/count, ut/count, st/count }' $MTIME +awk '{ total += $10; user += $4; sys += $6; count++ } END { printf "\nAverage:\ntotal %.3fs user %.3fs sys %.3fs\n", total/count, user/count, sys/count }' $MTIME rm -f $MTIME cp $TMP $ZSHRC