Skip to content

Commit

Permalink
CI: On Travis matrix "OPTIMIZE=-OO" flag ignored
Browse files Browse the repository at this point in the history
In order to address scipy#9373, we need a working (in this case failing) build however Travis doesn't seem to enable the `-OO` flag. This PR is for testing different options in the yaml file.

MAINT: Complete a few dangling "__doc__.split"s
  • Loading branch information
ilayn committed Oct 24, 2018
1 parent 1ec1c8a commit 151da07
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 65 deletions.
78 changes: 39 additions & 39 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,56 @@ env:
- OPENBLAS_NUM_THREADS=1
matrix:
include:
- python: 2.7
env:
- PYFLAKES=1
- PEP8=1
- NUMPYSPEC="--upgrade numpy"
before_install:
- pip install pycodestyle==2.3.1
- pip install pyflakes==1.1.0
script:
- PYFLAKES_NODOCTEST=1 pyflakes scipy benchmarks/benchmarks | grep -E -v 'unable to detect undefined names|assigned to but never used|imported but unused|redefinition of unused|may be undefined, or defined from star imports' > test.out; cat test.out; test \! -s test.out
- pycodestyle scipy benchmarks/benchmarks
- python: 2.7
env:
- TESTMODE=fast
- COVERAGE=
- NUMPYSPEC="--pre --upgrade --timeout=60 -f $PRE_WHEELS numpy"
- python: 3.7
dist: xenial # travis-ci/travis-ci/issues/9815
sudo: true
env:
- TESTMODE=full
- COVERAGE="--coverage --gcov"
- NUMPYSPEC="--upgrade numpy"
- python: 3.6
env:
- TESTMODE=fast
- COVERAGE=
- USE_WHEEL=1
- REFGUIDE_CHECK=1
- NUMPYSPEC="--upgrade numpy"
# - python: 2.7
# env:
# - PYFLAKES=1
# - PEP8=1
# - NUMPYSPEC="--upgrade numpy"
# before_install:
# - pip install pycodestyle==2.3.1
# - pip install pyflakes==1.1.0
# script:
# - PYFLAKES_NODOCTEST=1 pyflakes scipy benchmarks/benchmarks | grep -E -v 'unable to detect undefined names|assigned to but never used|imported but unused|redefinition of unused|may be undefined, or defined from star imports' > test.out; cat test.out; test \! -s test.out
# - pycodestyle scipy benchmarks/benchmarks
# - python: 2.7
# env:
# - TESTMODE=fast
# - COVERAGE=
# - NUMPYSPEC="--pre --upgrade --timeout=60 -f $PRE_WHEELS numpy"
# - python: 3.7
# dist: xenial # travis-ci/travis-ci/issues/9815
# sudo: true
# env:
# - TESTMODE=full
# - COVERAGE="--coverage --gcov"
# - NUMPYSPEC="--upgrade numpy"
# - python: 3.6
# env:
# - TESTMODE=fast
# - COVERAGE=
# - USE_WHEEL=1
# - REFGUIDE_CHECK=1
# - NUMPYSPEC="--upgrade numpy"
- python: 3.5
env:
- TESTMODE=fast
- COVERAGE=
- NUMPYSPEC="numpy==1.8.2"
- USE_SDIST=1
- OPTIMIZE=-OO
- python: 3.4
env:
- TESTMODE=fast
- COVERAGE=
- USE_WHEEL=1
- NUMPYSPEC="--upgrade numpy"
- os: osx
language: generic
env:
- TESTMODE=fast
- COVERAGE=
- NUMPYSPEC="--upgrade numpy"
- MB_PYTHON_VERSION=3.7
- PYTHONOPTIMIZE=2
# - os: osx
# language: generic
# env:
# - TESTMODE=fast
# - COVERAGE=
# - NUMPYSPEC="--upgrade numpy"
# - MB_PYTHON_VERSION=3.7
addons:
apt:
packages:
Expand Down Expand Up @@ -203,7 +203,7 @@ script:
USE_WHEEL_BUILD="--no-build"
fi
- export SCIPY_AVAILABLE_MEM=3G
- python -u $OPTIMIZE runtests.py -g -m $TESTMODE $COVERAGE $USE_WHEEL_BUILD -- -rfEX -n 3 2>&1 | tee runtests.log
- python -u runtests.py -g -m $TESTMODE $COVERAGE $USE_WHEEL_BUILD -- -rfEX -n 3 2>&1 | tee runtests.log
- tools/validate_runtests_log.py $TESTMODE < runtests.log
- if [ "${REFGUIDE_CHECK}" == "1" ]; then python runtests.py -g --refguide-check; fi
# Check dynamic symbol hiding works on Linux
Expand Down
61 changes: 39 additions & 22 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__)))


def main(argv):
parser = ArgumentParser(usage=__doc__.lstrip())
parser.add_argument("--verbose", "-v", action="count", default=1,
Expand All @@ -76,11 +77,11 @@ def main(argv):
parser.add_argument("--refguide-check", action="store_true", default=False,
help="Run refguide check (do not run regular tests.)")
parser.add_argument("--coverage", action="store_true", default=False,
help=("report coverage of project code. HTML output goes "
"under build/coverage"))
help=("report coverage of project code. HTML output"
" goes under build/coverage"))
parser.add_argument("--gcov", action="store_true", default=False,
help=("enable C code coverage via gcov (requires GCC). "
"gcov output goes to build/**/*.gc*"))
help=("enable C code coverage via gcov (requires GCC)."
" gcov output goes to build/**/*.gc*"))
parser.add_argument("--lcov-html", action="store_true", default=False,
help=("produce HTML for C code coverage information "
"from a previous run with --gcov. "
Expand All @@ -89,7 +90,8 @@ def main(argv):
help="'fast', 'full', or something that could be "
"passed to nosetests -A [default: fast]")
parser.add_argument("--submodule", "-s", default=None,
help="Submodule whose tests to run (cluster, constants, ...)")
help="Submodule whose tests to run (cluster,"
" constants, ...)")
parser.add_argument("--pythonpath", "-p", default=None,
help="Paths to prepend to PYTHONPATH")
parser.add_argument("--tests", "-t", action='append',
Expand All @@ -110,17 +112,19 @@ def main(argv):
parser.add_argument("--bench", action="store_true",
help="Run benchmark suite instead of test suite")
parser.add_argument("--bench-compare", action="append", metavar="BEFORE",
help=("Compare benchmark results of current HEAD to BEFORE. "
"Use an additional --bench-compare=COMMIT to override HEAD with COMMIT. "
"Note that you need to commit your changes first!"
))
help=("Compare benchmark results of current HEAD to"
" BEFORE. Use an additional "
"--bench-compare=COMMIT to override HEAD with"
" COMMIT. Note that you need to commit your "
"changes first!"
))
parser.add_argument("args", metavar="ARGS", default=[], nargs=REMAINDER,
help="Arguments to pass to Nose, Python or shell")
args = parser.parse_args(argv)

if args.bench_compare:
args.bench = True
args.no_build = True # ASV does the building
args.no_build = True # ASV does the building

if args.lcov_html:
# generate C code coverage output
Expand All @@ -135,7 +139,8 @@ def main(argv):
gcov_reset_counters()

if args.debug and args.bench:
print("*** Benchmarks should not be run against debug version; remove -g flag ***")
print("*** Benchmarks should not be run against debug version; "
"remove -g flag ***")

if not args.no_build:
site_dir = build_project(args)
Expand Down Expand Up @@ -217,19 +222,23 @@ def main(argv):

# Check for uncommitted files
if commit_b == 'HEAD':
r1 = subprocess.call(['git', 'diff-index', '--quiet', '--cached', 'HEAD'])
r1 = subprocess.call(['git', 'diff-index', '--quiet',
'--cached', 'HEAD'])
r2 = subprocess.call(['git', 'diff-files', '--quiet'])
if r1 != 0 or r2 != 0:
print("*"*80)
print("WARNING: you have uncommitted changes --- these will NOT be benchmarked!")
print("WARNING: you have uncommitted changes --- "
"these will NOT be benchmarked!")
print("*"*80)

# Fix commit ids (HEAD is local to current repo)
p = subprocess.Popen(['git', 'rev-parse', commit_b], stdout=subprocess.PIPE)
p = subprocess.Popen(['git', 'rev-parse', commit_b],
stdout=subprocess.PIPE)
out, err = p.communicate()
commit_b = out.strip()

p = subprocess.Popen(['git', 'rev-parse', commit_a], stdout=subprocess.PIPE)
p = subprocess.Popen(['git', 'rev-parse', commit_a],
stdout=subprocess.PIPE)
out, err = p.communicate()
commit_a = out.strip()

Expand Down Expand Up @@ -308,7 +317,8 @@ def build_project(args):
cmd = [sys.executable, 'setup.py']

# Always use ccache, if installed
env['PATH'] = os.pathsep.join(EXTRA_PATH + env.get('PATH', '').split(os.pathsep))
env['PATH'] = os.pathsep.join(EXTRA_PATH +
env.get('PATH', '').split(os.pathsep))

if args.debug or args.gcov:
# assume everyone uses gcc/gfortran
Expand All @@ -324,7 +334,8 @@ def build_project(args):
env['F77'] = 'gfortran --coverage '
env['F90'] = 'gfortran --coverage '
env['LDSHARED'] = cvars['LDSHARED'] + ' --coverage'
env['LDFLAGS'] = " ".join(cvars['LDSHARED'].split()[1:]) + ' --coverage'
env['LDFLAGS'] = " ".join(cvars['LDSHARED'].split()[1:]) +\
' --coverage'

cmd += ['build']
if args.parallel > 1:
Expand Down Expand Up @@ -367,7 +378,8 @@ def build_project(args):
log_size = os.stat(log_filename).st_size
if log_size > last_log_size:
elapsed = datetime.datetime.now() - start_time
print(" ... build in progress ({0} elapsed)".format(elapsed))
print(" ... build in progress ({0} "
"elapsed)".format(elapsed))
last_blip = time.time()
last_log_size = log_size

Expand Down Expand Up @@ -410,11 +422,16 @@ def gcov_reset_counters():
LCOV_OUTPUT_FILE = os.path.join(ROOT_DIR, 'build', 'lcov.out')
LCOV_HTML_DIR = os.path.join(ROOT_DIR, 'build', 'lcov')


def lcov_generate():
try: os.unlink(LCOV_OUTPUT_FILE)
except OSError: pass
try: shutil.rmtree(LCOV_HTML_DIR)
except OSError: pass
try:
os.unlink(LCOV_OUTPUT_FILE)
except OSError:
pass
try:
shutil.rmtree(LCOV_HTML_DIR)
except OSError:
pass

print("Capturing lcov info...")
subprocess.call(['lcov', '-q', '-c',
Expand Down
2 changes: 1 addition & 1 deletion scipy/sparse/generate_sparsetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def get_arglist(I_type, T_type):


def main():
p = optparse.OptionParser(usage=__doc__.strip())
p = optparse.OptionParser(usage=(__doc__ or '').strip())
p.add_option("--no-force", action="store_false",
dest="force", default=True)
options, args = p.parse_args()
Expand Down
4 changes: 3 additions & 1 deletion scipy/special/_generate_pyx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,13 +1333,15 @@ def unique(lst):
new_lst.append(item)
return new_lst


def all_newer(src_files, dst_files):
from distutils.dep_util import newer
return all(os.path.exists(dst) and newer(dst, src)
for dst in dst_files for src in src_files)


def main():
p = optparse.OptionParser(usage=__doc__.strip())
p = optparse.OptionParser(usage=(__doc__ or '').strip())
options, args = p.parse_args()
if len(args) != 0:
p.error('invalid number of arguments')
Expand Down
2 changes: 1 addition & 1 deletion scipy/special/utils/makenpz.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


def main():
p = argparse.ArgumentParser(usage=__doc__.strip())
p = argparse.ArgumentParser(usage=(__doc__ or '').strip())
p.add_argument('--use-timestamp', action='store_true', default=False,
help="don't rewrite npz file if it is newer than sources")
p.add_argument('dirname')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""

DOCLINES = __doc__.split("\n")
DOCLINES = (__doc__ or '').split("\n")

import os
import sys
Expand Down

0 comments on commit 151da07

Please sign in to comment.