Fix broken tests

This commit is contained in:
Yamashita, Yuu 2017-11-03 09:43:02 +00:00
parent ecc5ff5ead
commit 9ff06f61b6
3 changed files with 75 additions and 72 deletions

View file

@ -63,17 +63,18 @@ assert_build_log() {
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
# pyenv/pyenv#1026
stub uname false false
stub uname '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
# yyuu/pyenv#257
stub uname '-s : echo Linux'
stub uname '-s : echo Linux'
install_fixture definitions/needs-yaml install_fixture definitions/needs-yaml
assert_success assert_success
unstub uname
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
@ -92,18 +93,19 @@ OUT
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
# pyenv/pyenv#1026
stub uname false false
stub uname '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log' stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'
# yyuu/pyenv#257
stub uname '-s : echo Linux'
stub uname '-s : echo Linux'
TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<"" TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<""
assert_success assert_success
unstub uname
unstub make unstub make
unstub patch unstub patch
@ -124,18 +126,19 @@ OUT
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log' stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'
# yyuu/pyenv#257 # pyenv/pyenv#1026
stub uname '-s : echo Linux' stub uname false false
stub uname '-s : echo Linux'
TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<"diff --git a/script.py" TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<"diff --git a/script.py"
assert_success assert_success
unstub uname
unstub make unstub make
unstub patch unstub patch
@ -158,16 +161,17 @@ OUT
brew_libdir="$TMP/homebrew-yaml" brew_libdir="$TMP/homebrew-yaml"
mkdir -p "$brew_libdir" mkdir -p "$brew_libdir"
# pyenv/pyenv#1026
stub uname false false
stub uname '-s : echo Linux'
stub brew "--prefix libyaml : echo '$brew_libdir'" false stub brew "--prefix libyaml : echo '$brew_libdir'" false
stub_make_install stub_make_install
# yyuu/pyenv#257
stub uname '-s : echo Linux'
stub uname '-s : echo Linux'
install_fixture definitions/needs-yaml install_fixture definitions/needs-yaml
assert_success assert_success
unstub uname
unstub brew unstub brew
unstub make unstub make
@ -185,13 +189,12 @@ OUT
readline_libdir="$TMP/homebrew-readline" readline_libdir="$TMP/homebrew-readline"
mkdir -p "$readline_libdir" mkdir -p "$readline_libdir"
# pyenv/pyenv#1026
stub uname false false
stub brew "--prefix readline : echo '$readline_libdir'" stub brew "--prefix readline : echo '$readline_libdir'"
stub_make_install stub_make_install
# yyuu/pyenv#257
stub uname '-s : echo Linux'
stub uname '-s : echo Linux'
run_inline_definition <<DEF run_inline_definition <<DEF
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz" install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
DEF DEF
@ -216,13 +219,12 @@ OUT
mkdir -p "$readline_libdir/include/readline" mkdir -p "$readline_libdir/include/readline"
touch "$readline_libdir/include/readline/rlconf.h" touch "$readline_libdir/include/readline/rlconf.h"
# pyenv/pyenv#1026
stub uname false false
stub brew stub brew
stub_make_install stub_make_install
# yyuu/pyenv#257
stub uname '-s : echo Linux'
stub uname '-s : echo Linux'
export PYTHON_CONFIGURE_OPTS="CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib" export PYTHON_CONFIGURE_OPTS="CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib"
run_inline_definition <<DEF run_inline_definition <<DEF
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz" install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
@ -250,8 +252,7 @@ OUT
# yyuu/pyenv#257 # yyuu/pyenv#257
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin' false
stub sysctl false stub sysctl false
stub_make_install stub_make_install
@ -282,8 +283,7 @@ OUT
# yyuu/pyenv#257 # yyuu/pyenv#257
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin' false
stub sysctl '-n hw.ncpu : echo 4' stub sysctl '-n hw.ncpu : echo 4'
stub_make_install stub_make_install
@ -308,16 +308,13 @@ OUT
@test "number of CPU cores is detected on FreeBSD" { @test "number of CPU cores is detected on FreeBSD" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname '-s : echo FreeBSD' # pyenv/pyenv#1026
stub uname false false
stub uname '-s : echo FreeBSD' false
stub sysctl '-n hw.ncpu : echo 1' stub sysctl '-n hw.ncpu : echo 1'
stub_make_install stub_make_install
# yyuu/pyenv#222
stub uname '-s : echo FreeBSD'
# yyuu/pyenv#257
stub uname '-s : echo FreeBSD'
export -n MAKE_OPTS export -n MAKE_OPTS
run_inline_definition <<DEF run_inline_definition <<DEF
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz" install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
@ -339,11 +336,11 @@ OUT
@test "setting PYTHON_MAKE_INSTALL_OPTS to a multi-word string" { @test "setting PYTHON_MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub_make_install # pyenv/pyenv#1026
stub uname false false
# yyuu/pyenv#257
stub uname '-s : echo Linux'
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub_make_install
export PYTHON_MAKE_INSTALL_OPTS="DOGE=\"such wow\"" export PYTHON_MAKE_INSTALL_OPTS="DOGE=\"such wow\""
run_inline_definition <<DEF run_inline_definition <<DEF
@ -351,6 +348,7 @@ install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.
DEF DEF
assert_success assert_success
unstub uname
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
@ -364,11 +362,11 @@ OUT
@test "setting MAKE_INSTALL_OPTS to a multi-word string" { @test "setting MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub_make_install # pyenv/pyenv#1026
stub uname false false
# yyuu/pyenv#257
stub uname '-s : echo Linux'
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub_make_install
export MAKE_INSTALL_OPTS="DOGE=\"such wow\"" export MAKE_INSTALL_OPTS="DOGE=\"such wow\""
run_inline_definition <<DEF run_inline_definition <<DEF
@ -376,6 +374,7 @@ install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.
DEF DEF
assert_success assert_success
unstub uname
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
@ -398,15 +397,13 @@ OUT
@test "make on FreeBSD 9 defaults to gmake" { @test "make on FreeBSD 9 defaults to gmake" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 9.1" stub uname "-s : echo FreeBSD" "-r : echo 9.1" false
# pyenv/pyenv#1026
stub uname false false
MAKE=gmake stub_make_install MAKE=gmake stub_make_install
# yyuu/pyenv#222
stub uname '-s : echo FreeBSD'
# yyuu/pyenv#257
stub uname '-s : echo FreeBSD'
MAKE= install_fixture definitions/vanilla-python MAKE= install_fixture definitions/vanilla-python
assert_success assert_success
@ -417,14 +414,28 @@ OUT
@test "make on FreeBSD 10" { @test "make on FreeBSD 10" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE" stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE" false
# pyenv/pyenv#1026
stub uname false false
stub_make_install stub_make_install
# yyuu/pyenv#222 MAKE= install_fixture definitions/vanilla-python
stub uname '-s : echo FreeBSD' assert_success
# yyuu/pyenv#257 unstub uname
stub uname '-s : echo FreeBSD' }
@test "make on FreeBSD 11" {
cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 11.0-RELEASE" false
# pyenv/pyenv#1026
stub uname false false
stub_make_install
MAKE= install_fixture definitions/vanilla-python MAKE= install_fixture definitions/vanilla-python
assert_success assert_success
@ -441,6 +452,7 @@ apply -p1 -i /my/patch.diff
exec ./configure "\$@" exec ./configure "\$@"
CONF CONF
stub uname '-s : echo Linux'
stub apply 'echo apply "$@" >> build.log' stub apply 'echo apply "$@" >> build.log'
stub_make_install stub_make_install
@ -454,6 +466,7 @@ install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.
DEF DEF
assert_success assert_success
unstub uname
unstub make unstub make
unstub apply unstub apply

View file

@ -8,16 +8,13 @@ export -n CC
export -n PYTHON_CONFIGURE_OPTS export -n PYTHON_CONFIGURE_OPTS
@test "require_gcc on OS X 10.9" { @test "require_gcc on OS X 10.9" {
# yyuu/pyenv#222 # pyenv/pyenv#1026
stub uname '-s : echo Darwin' stub uname false '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5' stub sw_vers '-productVersion : echo 10.9.5'
# yyuu/pyenv#257
stub uname '-s : echo Darwin'
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5' stub sw_vers '-productVersion : echo 10.9.5'
stub gcc '--version : echo 4.2.1' stub gcc '--version : echo 4.2.1' '--version : echo 4.2.1'
run_inline_definition <<DEF run_inline_definition <<DEF
require_gcc require_gcc
@ -32,16 +29,13 @@ OUT
} }
@test "require_gcc on OS X 10.10" { @test "require_gcc on OS X 10.10" {
# yyuu/pyenv#222 # pyenv/pyenv#1026
stub uname '-s : echo Darwin' stub uname false '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
# yyuu/pyenv#257
stub uname '-s : echo Darwin'
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
stub gcc '--version : echo 4.2.1' stub gcc '--version : echo 4.2.1' '--version : echo 4.2.1'
run_inline_definition <<DEF run_inline_definition <<DEF
require_gcc require_gcc
@ -56,7 +50,7 @@ OUT
} }
@test "require_gcc silences warnings" { @test "require_gcc silences warnings" {
stub gcc '--version : echo warning >&2; echo 4.2.1' stub gcc '--version : echo warning >&2; echo 4.2.1' '--version : echo warning >&2; echo 4.2.1'
run_inline_definition <<DEF run_inline_definition <<DEF
require_gcc require_gcc
@ -69,14 +63,10 @@ DEF
mkdir -p "$INSTALL_ROOT" mkdir -p "$INSTALL_ROOT"
cd "$INSTALL_ROOT" cd "$INSTALL_ROOT"
# yyuu/pyenv#222 # pyenv/pyenv#1026
stub uname '-s : echo Darwin' stub uname false '-s : echo Darwin' false '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
# yyuu/pyenv#257
stub uname '-s : echo Darwin'
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
stub cc 'false' stub cc 'false'
stub brew 'false' stub brew 'false'

View file

@ -3,7 +3,7 @@ export TMP="$BATS_TEST_DIRNAME/tmp"
if [ "$FIXTURE_ROOT" != "$BATS_TEST_DIRNAME/fixtures" ]; then if [ "$FIXTURE_ROOT" != "$BATS_TEST_DIRNAME/fixtures" ]; then
export FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures" export FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures"
export INSTALL_ROOT="$TMP/install" export INSTALL_ROOT="$TMP/install"
PATH=/usr/bin:/usr/sbin:/bin/:/sbin PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PATH="$BATS_TEST_DIRNAME/../bin:$PATH" PATH="$BATS_TEST_DIRNAME/../bin:$PATH"
PATH="$TMP/bin:$PATH" PATH="$TMP/bin:$PATH"
export PATH export PATH