From 2086810af2b415c2acfe73508c6e0c87940513b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Tue, 9 Jun 2015 16:11:28 +0200 Subject: [PATCH 1/6] test: support writing test output to file This is a minimal effort to support test output written both to stdout and file in order to get our buildbots understanding test output. Cherry picked from https://github.com/jbergstroem/io.js/commit/31940738e2d256e91c1c694c5219b8f840c629ff Original commit metadata follows: PR-URL: https://github.com/iojs/io.js/pull/934 Reviewed-By: Chris Dickinson Reviewed-By: Ben Noordhuis --- tools/test.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tools/test.py b/tools/test.py index 579d444f6c59..b85da6ae6c6c 100755 --- a/tools/test.py +++ b/tools/test.py @@ -29,6 +29,7 @@ import imp +import logging import optparse import os import platform @@ -45,6 +46,8 @@ from datetime import datetime from Queue import Queue, Empty +logger = logging.getLogger('testrunner') + VERBOSE = False @@ -225,7 +228,7 @@ def HasRun(self, output): class TapProgressIndicator(SimpleProgressIndicator): def Starting(self): - print '1..%i' % len(self.cases) + logger.info('1..%i' % len(self.cases)) self._done = 0 def AboutToRun(self, case): @@ -238,16 +241,16 @@ def HasRun(self, output): status_line = 'not ok %i - %s' % (self._done, command) if FLAKY in output.test.outcomes and self.flaky_tests_mode == "dontcare": status_line = status_line + " # TODO : Fix flaky test" - print status_line + logger.info(status_line) for l in output.output.stderr.splitlines(): - print '#' + l + logger.info('#' + l) for l in output.output.stdout.splitlines(): - print '#' + l + logger.info('#' + l) else: status_line = 'ok %i - %s' % (self._done, command) if FLAKY in output.test.outcomes: status_line = status_line + " # TODO : Fix flaky test" - print status_line + logger.info(status_line) duration = output.test.duration @@ -255,9 +258,9 @@ def HasRun(self, output): total_seconds = (duration.microseconds + (duration.seconds + duration.days * 24 * 3600) * 10**6) / 10**6 - print ' ---' - print ' duration_ms: %d.%d' % (total_seconds, duration.microseconds / 1000) - print ' ...' + logger.info(' ---') + logger.info(' duration_ms: %d.%d' % (total_seconds, duration.microseconds / 1000)) + logger.info(' ...') def Done(self): pass @@ -1192,6 +1195,8 @@ def BuildOptions(): default='release') result.add_option("-v", "--verbose", help="Verbose output", default=False, action="store_true") + result.add_option('--logfile', dest='logfile', + help='write test output to file. NOTE: this only applies the tap progress indicator') result.add_option("-S", dest="scons_flags", help="Flag to pass through to scons", default=[], action="append") result.add_option("-p", "--progress", @@ -1368,6 +1373,13 @@ def Main(): parser.print_help() return 1 + ch = logging.StreamHandler(sys.stdout) + logger.addHandler(ch) + logger.setLevel('INFO') + if options.logfile: + fh = logging.FileHandler(options.logfile) + logger.addHandler(fh) + workspace = abspath(join(dirname(sys.argv[0]), '..')) suites = GetSuites(join(workspace, 'test')) repositories = [TestRepository(join(workspace, 'test', name)) for name in suites] From 67ebb6867263ec9e96a455498448de65a69ec044 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 24 Jan 2015 01:06:07 +0100 Subject: [PATCH 2/6] build: disable v8 snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Snapshots speed up start-up by a few milliseconds but are potentially dangerous because of the fixed hash seed that is used for strings and dictionaries, making collision denial-of-service attacks possible. Release builds on iojs.org have snapshots disabled but source builds did not, until now. The risk for individual source builds is low; the binary gets a random 32 bits hash seed that should be hard to guess by an external attacker. It's when binaries are distributed by, for example, a distro vendor that the fixed hash seed becomes a vulnerability, because then it's possible to target a large group of people at once. People that really need the faster start-up time can use the new --with-snapshot configure flag. Cherry picked from https://github.com/bnoordhuis/io.js/commit/4f68369643cbbbcc6b12028091bb8064e89ce02d Original commit metadata below: PR-URL: https://github.com/iojs/io.js/pull/585 Reviewed-By: Bert Belder Reviewed-By: Johan Bergström Reviewed-By: Rod Vagg --- Makefile | 8 ++++---- android-configure | 1 - configure | 21 ++++++++++++++++----- node.gyp | 2 +- vcbuild.bat | 12 ++++++------ 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 1629d14f74d0..258543704703 100644 --- a/Makefile +++ b/Makefile @@ -306,11 +306,11 @@ $(PKG): release-only rm -rf $(PKGDIR) rm -rf out/deps out/Release $(PYTHON) ./configure --download=all --with-intl=small-icu \ - --without-snapshot --dest-cpu=ia32 --tag=$(TAG) + --dest-cpu=ia32 --tag=$(TAG) $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32 rm -rf out/deps out/Release $(PYTHON) ./configure --download=all --with-intl=small-icu \ - --without-snapshot --dest-cpu=x64 --tag=$(TAG) + --dest-cpu=x64 --tag=$(TAG) $(MAKE) install V=$(V) DESTDIR=$(PKGDIR) SIGN="$(APP_SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh lipo $(PKGDIR)/32/usr/local/bin/node \ @@ -343,7 +343,7 @@ $(BINARYTAR): release-only rm -rf $(BINARYNAME) rm -rf out/deps out/Release $(PYTHON) ./configure --prefix=/ --download=all --with-intl=small-icu \ - --without-snapshot --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS) + --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS) $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1 cp README.md $(BINARYNAME) cp LICENSE $(BINARYNAME) @@ -356,7 +356,7 @@ binary: $(BINARYTAR) $(PKGSRC): release-only rm -rf dist out - $(PYTHON) configure --prefix=/ --without-snapshot --download=all \ + $(PYTHON) configure --prefix=/ --download=all \ --with-intl=small-icu --dest-cpu=$(DESTCPU) --tag=$(TAG) \ $(CONFIG_FLAGS) $(MAKE) install DESTDIR=dist diff --git a/android-configure b/android-configure index 7acb7f37661a..b3145e58386c 100755 --- a/android-configure +++ b/android-configure @@ -14,6 +14,5 @@ export CXX=arm-linux-androideabi-g++ export LINK=arm-linux-androideabi-g++ ./configure \ - --without-snapshot \ --dest-cpu=arm \ --dest-os=android diff --git a/configure b/configure index 66cb312ddb86..636bc78f05b4 100755 --- a/configure +++ b/configure @@ -292,11 +292,16 @@ parser.add_option('--without-perfctr', dest='without_perfctr', help='build without performance counters') +parser.add_option('--with-snapshot', + action='store_true', + dest='with_snapshot', + help=optparse.SUPPRESS_HELP) + +# Dummy option for backwards compatibility. parser.add_option('--without-snapshot', action='store_true', - dest='without_snapshot', - help='build without snapshotting V8 libraries. You might want to set' - ' this for cross-compiling. [Default: False]') + dest='unused_without_snapshot', + help=optparse.SUPPRESS_HELP) parser.add_option('--without-ssl', action='store_true', @@ -323,6 +328,12 @@ parser.add_option('--xcode', # set up auto-download list auto_downloads = nodedownload.parse(options.download_list) + +def warn(msg): + prefix = '\033[1m\033[91mWARNING\033[0m' if os.isatty(1) else 'WARNING' + print('%s: %s' % (prefix, msg)) + + def b(value): """Returns the string 'true' if value is truthy, 'false' otherwise.""" if value: @@ -515,7 +526,7 @@ def configure_node(o): o['variables']['host_arch'] = host_arch o['variables']['target_arch'] = target_arch - if target_arch != host_arch and not options.without_snapshot: + if target_arch != host_arch and options.with_snapshot: o['variables']['want_separate_host_toolset'] = 1 else: o['variables']['want_separate_host_toolset'] = 0 @@ -651,7 +662,7 @@ def configure_v8(o): o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs. o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds. o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. - o['variables']['v8_use_snapshot'] = b(not options.without_snapshot) + o['variables']['v8_use_snapshot'] = b(options.with_snapshot) # assume shared_v8 if one of these is set? if options.shared_v8_libpath: diff --git a/node.gyp b/node.gyp index 46dbf396c690..86cc7d1e6bca 100644 --- a/node.gyp +++ b/node.gyp @@ -1,6 +1,6 @@ { 'variables': { - 'v8_use_snapshot%': 'true', + 'v8_use_snapshot%': 'false', 'node_use_dtrace%': 'false', 'node_use_etw%': 'false', 'node_use_perfctr%': 'false', diff --git a/vcbuild.bat b/vcbuild.bat index 96ffeed02f77..17a8d082e3aa 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -17,11 +17,11 @@ set msiplatform=x86 set target=Build set target_arch=ia32 set debug_arg= -set nosnapshot_arg= +set snapshot_arg= set noprojgen= set nobuild= set nosign= -set nosnapshot= +set snapshot= set test= set test_args= set msi= @@ -50,7 +50,7 @@ if /i "%1"=="x64" set target_arch=x64&goto arg-ok if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok if /i "%1"=="nobuild" set nobuild=1&goto arg-ok if /i "%1"=="nosign" set nosign=1&goto arg-ok -if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok +if /i "%1"=="snapshot" set snapshot=1&goto arg-ok if /i "%1"=="noetw" set noetw=1&goto arg-ok if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok if /i "%1"=="licensertf" set licensertf=1&goto arg-ok @@ -84,7 +84,7 @@ if defined upload goto upload if defined jslint goto jslint if defined build_release ( - set nosnapshot=1 + set snapshot= set config=Release set msi=1 set licensertf=1 @@ -94,7 +94,7 @@ if defined build_release ( if "%config%"=="Debug" set debug_arg=--debug if "%target_arch%"=="x64" set msiplatform=x64 -if defined nosnapshot set nosnapshot_arg=--without-snapshot +if defined snapshot set snapshot_arg=--with-snapshot if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1 if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1 @@ -151,7 +151,7 @@ goto exit if defined noprojgen goto msbuild @rem Generate the VS project. -python configure %download_arg% %i18n_arg% %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG% +python configure %download_arg% %i18n_arg% %debug_arg% %snapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG% if errorlevel 1 goto create-msvs-files-failed if not exist node.sln goto create-msvs-files-failed echo Project files generated. From 0a65e72199d26fde934260376ced5cab48b92642 Mon Sep 17 00:00:00 2001 From: Alexis Campailla Date: Tue, 9 Jun 2015 18:45:21 +0200 Subject: [PATCH 3/6] build: support Jenkins via test-ci --- Makefile | 5 +++++ vcbuild.bat | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 258543704703..50ad131729fc 100644 --- a/Makefile +++ b/Makefile @@ -418,6 +418,11 @@ bench-idle: sleep 1 ./node benchmark/idle_clients.js & +test-ci: + $(PYTHON) tools/test.py -ptap --logfile test.tap --mode=release --arch=$(DESTCPU) simple message internet + $(MAKE) jslint + $(MAKE) cpplint + jslintfix: PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js diff --git a/vcbuild.bat b/vcbuild.bat index 17a8d082e3aa..97ee42059e91 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -61,7 +61,8 @@ if /i "%1"=="test-simple" set test=test-simple&goto arg-ok if /i "%1"=="test-message" set test=test-message&goto arg-ok if /i "%1"=="test-gc" set test=test-gc&set buildnodeweak=1&goto arg-ok if /i "%1"=="test-all" set test=test-all&set buildnodeweak=1&goto arg-ok -if /i "%1"=="test" set test=test&goto arg-ok +if /i "%1"=="test-ci" set test=test-ci&set jslint=1&goto arg-ok +if /i "%1"=="test" set test=test&set jslint=1&goto arg-ok @rem Include small-icu support with MSI installer if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok if /i "%1"=="upload" set upload=1&goto arg-ok @@ -81,7 +82,6 @@ goto next-arg :args-done if defined upload goto upload -if defined jslint goto jslint if defined build_release ( set snapshot= @@ -202,7 +202,11 @@ if "%test%"=="" goto exit if "%config%"=="Debug" set test_args=--mode=debug if "%config%"=="Release" set test_args=--mode=release +set test_args=%test_args% --arch=%target_arch% + + if "%test%"=="test" set test_args=%test_args% simple message +if "%test%"=="test-ci" set test_args=%test_args% -p tap --logfile test.tap simple message internet if "%test%"=="test-internet" set test_args=%test_args% internet if "%test%"=="test-pummel" set test_args=%test_args% pummel if "%test%"=="test-simple" set test_args=%test_args% simple @@ -224,7 +228,7 @@ goto exit :run-tests echo running 'python tools/test.py %test_args%' python tools/test.py %test_args% -if "%test%"=="test" goto jslint +if defined jslint goto jslint goto exit :create-msvs-files-failed From 7c8db1430ee64a360191b7164c241dcb654bb3a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Sat, 30 May 2015 13:46:12 +1000 Subject: [PATCH 4/6] tools: pass constant to logger instead of string On a few of our installations (namely CentOS), passing 'INFO' resulted in a silent loglevel. Use a logging constant instead. Cherry-picked from https://github.com/nodejs/io.js/commit/8606793999979829df002c2ab69235a05605fc4d Original commit metadata follows: Fixes: https://github.com/nodejs/build/issues/104 PR-URL: https://github.com/nodejs/io.js/pull/1842 Reviewed-By: Rod Vagg --- tools/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test.py b/tools/test.py index b85da6ae6c6c..e14ade371289 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1375,7 +1375,7 @@ def Main(): ch = logging.StreamHandler(sys.stdout) logger.addHandler(ch) - logger.setLevel('INFO') + logger.setLevel(logging.INFO) if options.logfile: fh = logging.FileHandler(options.logfile) logger.addHandler(fh) From 77dbf0763bf7cd077c178eb770ad5ada4afe97ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Sat, 13 Jun 2015 12:25:35 +1000 Subject: [PATCH 5/6] build: don't run lint from test-ci Since we will run linting before compiling or testing there's no need to run it as part of the ci testing. Cherry-picked from https://github.com/nodejs/io.js/commit/8d8a26e8f7b4e65191af80d94bccada2217cbbb2 Original commit metadata follows: PR-URL: https://github.com/nodejs/io.js/pull/1965 Reviewed-By: Colin Ihrig Revewied-By: Evan Lucas --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 50ad131729fc..b6ee1915eb18 100644 --- a/Makefile +++ b/Makefile @@ -127,6 +127,9 @@ test-all-http1: test-build test-all-valgrind: test-build $(PYTHON) tools/test.py --mode=debug,release --valgrind +test-ci: + $(PYTHON) tools/test.py -ptap --logfile test.tap --mode=release --arch=$(DESTCPU) simple message internet + test-release: test-build $(PYTHON) tools/test.py --mode=release @@ -418,11 +421,6 @@ bench-idle: sleep 1 ./node benchmark/idle_clients.js & -test-ci: - $(PYTHON) tools/test.py -ptap --logfile test.tap --mode=release --arch=$(DESTCPU) simple message internet - $(MAKE) jslint - $(MAKE) cpplint - jslintfix: PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js From f6cf940ec9ffc9645e75ab8897ec7ccf60fa5d8a Mon Sep 17 00:00:00 2001 From: Alexis Campailla Date: Thu, 18 Jun 2015 17:28:21 +0200 Subject: [PATCH 6/6] build: remove lint from test-ci on windows There is now a sepearate linter job taking care of running jslint. See https://github.com/nodejs/io.js/pull/2004 --- vcbuild.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcbuild.bat b/vcbuild.bat index 97ee42059e91..c15df326bb02 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -61,7 +61,7 @@ if /i "%1"=="test-simple" set test=test-simple&goto arg-ok if /i "%1"=="test-message" set test=test-message&goto arg-ok if /i "%1"=="test-gc" set test=test-gc&set buildnodeweak=1&goto arg-ok if /i "%1"=="test-all" set test=test-all&set buildnodeweak=1&goto arg-ok -if /i "%1"=="test-ci" set test=test-ci&set jslint=1&goto arg-ok +if /i "%1"=="test-ci" set test=test-ci&goto arg-ok if /i "%1"=="test" set test=test&set jslint=1&goto arg-ok @rem Include small-icu support with MSI installer if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok