From 65c848cc6f13cb5ae3bc1c0fb5fbb320ed2d0200 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 7 Mar 2017 19:25:12 +0800 Subject: include benchmark.js in test suite (#1564) - report file sizes and overall run time - exit with non-zero code upon error --- test/benchmark.js | 45 ++++++++++++++++++++++++++++++++++++++------- test/mocha/benchmark.js | 24 ++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 test/mocha/benchmark.js (limited to 'test') diff --git a/test/benchmark.js b/test/benchmark.js index dc176a88..c150e5cf 100644 --- a/test/benchmark.js +++ b/test/benchmark.js @@ -24,26 +24,57 @@ var results = {}; var remaining = 2 * urls.length; function done() { if (!--remaining) { + var failures = []; urls.forEach(function(url) { + var info = results[url]; console.log(); console.log(url); - console.log(results[url].time); - console.log("SHA1:", results[url].sha1); + console.log(info.log); + var elapsed = 0; + info.log.replace(/: ([0-9]+\.[0-9]{3})s/g, function(match, time) { + elapsed += parseFloat(time); + }); + console.log("Run-time:", elapsed.toFixed(3), "s"); + console.log("Original:", info.input, "bytes"); + console.log("Uglified:", info.output, "bytes"); + console.log("SHA1 sum:", info.sha1); + if (info.code) { + failures.push(url); + } }); + if (failures.length) { + console.error("Benchmark failed:"); + failures.forEach(function(url) { + console.error(url); + }); + process.exit(1); + } } } urls.forEach(function(url) { - results[url] = { time: "" }; + results[url] = { + input: 0, + output: 0, + log: "" + }; require(url.slice(0, url.indexOf(":"))).get(url, function(res) { var uglifyjs = fork("bin/uglifyjs", args, { silent: true }); - res.pipe(uglifyjs.stdin); - uglifyjs.stdout.pipe(createHash("sha1")).on("data", function(data) { + res.on("data", function(data) { + results[url].input += data.length; + }).pipe(uglifyjs.stdin); + uglifyjs.stdout.on("data", function(data) { + results[url].output += data.length; + }).pipe(createHash("sha1")).on("data", function(data) { results[url].sha1 = data.toString("hex"); done(); }); uglifyjs.stderr.setEncoding("utf8"); uglifyjs.stderr.on("data", function(data) { - results[url].time += data; - }).on("end", done) + results[url].log += data; + }); + uglifyjs.on("exit", function(code) { + results[url].code = code; + done(); + }); }); }); diff --git a/test/mocha/benchmark.js b/test/mocha/benchmark.js new file mode 100644 index 00000000..c2c7c02c --- /dev/null +++ b/test/mocha/benchmark.js @@ -0,0 +1,24 @@ +var assert = require("assert"); +var exec = require("child_process").exec; + +describe("test/benchmark.js", function() { + this.timeout(120000); + var command = '"' + process.argv[0] + '" test/benchmark.js '; + [ + "-b", + "-b bracketize", + "-m", + "-mc passes=3", + "-mc passes=3,toplevel", + "-mc passes=3,unsafe", + "-mc keep_fargs=false,passes=3", + "-mc keep_fargs=false,passes=3,pure_getters,unsafe,unsafe_comps,unsafe_math,unsafe_proto", + ].forEach(function(args) { + it("Should pass with options " + args, function(done) { + exec(command + args, function(err) { + if (err) throw err; + done(); + }); + }); + }); +}); -- cgit v1.2.3 0-01 15:47:55 -0400'>2020-10-01services: %desktop-services: Setuid root NTFS and NFS mount helpers....Fixes <https://issues.guix.info/39670>. Combined with commit def6e2ae46, this allows unprivileged users to mount file systems marked with the "user" option. It adds less than 4 MiB to the closure of the lightweight-desktop.tmpl operating system template. * gnu/services/desktop.scm (%desktop-services): Extend the setuid-program-service-type service with the 'mount.nfs' and 'mount.nfs-3g' programs. Reported-by: Nathan Dehnel <ncdehnel@gmail.com> Maxim Cournoyer 2020-09-28services: Add elogind ‘handle-lid-switch-external-power’....* gnu/services/desktop.scm <elogind-configuration>: Add an handle-lid-switch-external-power field, mapping to the HandleLidSwitchExternalPower logind.conf setting. * doc/guix.texi (Desktop Services): ‘Document’ it. Tobias Geerinckx-Rice 2020-09-23services: Allow (service bluetooth-service-type)....* gnu/services/desktop.scm (bluetooth-service-type) [default-value]: Set to (bluetooth-configuration). Tobias Geerinckx-Rice 2020-08-19services: Allow (service accountsservice-service-type)....* gnu/services/desktop.scm (accountsservice-service-type) [default-value]: Set to accountsservice. Tobias Geerinckx-Rice 2020-05-24gnu: enlightenment: Update to 0.24.0....* gnu/packages/enlightenment.scm (enlightenment): Update to 0.24.0. [arguments]: Change configure-flags to hardcode efl binary locations. Remove custom 'fix-dot-desktop-creation phase. Update 'set-system-actions phase. * gnu/packages/patches/enlightenment-fix-setuid-path.patch: Update for new upstream version. * gnu/services/desktop.scm (enlightenment-setuid-programs): Same. Efraim Flashner 2020-05-13mailmap: Update entries for Nikita....* .mailmap: change email and name for Nikita. * Makefile.am, doc/guix.texi, etc/completion/fish/guix.fish, gnu/packages/accessibility.scm, gnu/packages/admin.scm, gnu/packages/audio.scm, gnu/packages/autotools.scm, gnu/packages/cdrom.scm, gnu/packages/check.scm, gnu/packages/cinnamon.scm, gnu/packages/compression.scm, gnu/packages/crypto.scm, gnu/packages/databases.scm, gnu/packages/django.scm, gnu/packages/dns.scm, gnu/packages/elixir.scm, gnu/packages/emacs-xyz.scm, gnu/packages/emacs.scm, gnu/packages/enlightenment.scm, gnu/packages/erlang.scm, gnu/packages/fonts.scm, gnu/packages/fontutils.scm, gnu/packages/forth.scm, gnu/packages/fvwm.scm, gnu/packages/games.scm, gnu/packages/gl.scm, gnu/packages/gnome.scm, gnu/packages/gnunet.scm, gnu/packages/gnupg.scm, gnu/packages/gtk.scm, gnu/packages/guile-wm.scm, gnu/packages/guile-xyz.scm, gnu/packages/haskell-apps.scm, gnu/packages/haskell-check.scm, gnu/packages/haskell-crypto.scm, gnu/packages/haskell-xyz.scm, gnu/packages/haskell.scm, gnu/packages/image-viewers.scm, gnu/packages/image.scm, gnu/packages/irc.scm, gnu/packages/language.scm, gnu/packages/libcanberra.scm, gnu/packages/linux.scm, gnu/packages/lisp-xyz.scm, gnu/packages/lisp.scm, gnu/packages/lolcode.scm, gnu/packages/lxde.scm, gnu/packages/lxqt.scm, gnu/packages/mail.scm, gnu/packages/markup.scm, gnu/packages/mate.scm, gnu/packages/maths.scm, gnu/packages/mc.scm, gnu/packages/messaging.scm, gnu/packages/music.scm, gnu/packages/ncurses.scm, gnu/packages/networking.scm, gnu/packages/nickle.scm, gnu/packages/openbox.scm, gnu/packages/pdf.scm, gnu/packages/perl-check.scm, gnu/packages/perl.scm, gnu/packages/python-compression.scm, gnu/packages/python-crypto.scm, gnu/packages/python-web.scm, gnu/packages/python-xyz.scm, gnu/packages/python.scm, gnu/packages/qt.scm, gnu/packages/ruby.scm, gnu/packages/rust.scm, gnu/packages/scheme.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/ssh.scm, gnu/packages/suckless.scm, gnu/packages/tbb.scm, gnu/packages/telephony.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tls.scm, gnu/packages/tor.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vim.scm, gnu/packages/web.scm, gnu/packages/wm.scm, gnu/packages/xdisorg.scm, gnu/packages/xfce.scm, gnu/packages/xml.scm, gnu/packages/xorg.scm, gnu/services/certbot.scm, gnu/services/desktop.scm, gnu/services/version-control.scm, gnu/services/web.scm, guix/import/hackage.scm, guix/licenses.scm: Likewise. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> nikita 2020-04-21services: Don't use the deprecated 'make-forkexec-constructor' call....Passing 'make-forkexec-constructor' a string or several string arguments has been deprecated since dmd 0.1. * gnu/services/base.scm (rngd-service-type): In 'start' method, pass a list as the first argument to 'make-forkexec-constructor'. * gnu/services/desktop.scm (bluetooth-shepherd-service): Likewise. * gnu/services/spice.scm (spice-vdagent-shepherd-service): Likewise. Ludovic Courtès 2020-04-10services: gnome: Fix ‘gnome’ field name....To match its own documentation & other similar services. * gnu/services/desktop.scm (gnome-desktop-configuration)[gnome-package]: Rename to… [gnome]: …this. Tobias Geerinckx-Rice 2020-04-02services: mate: Provide all the polkit actions....* gnu/services/desktop.scm (mate-polkit-extension): New procedure. (mate-desktop-service-type): Use it when extending POLKIT-SERVICE-TYPE. Ludovic Courtès 2020-03-22services: Add fontconfig-file-system-service....* gnu/services/desktop.scm (%fontconfig-file-system, fontconfig-file-system-service): New variables. (%desktop-services): Add fontconfig-file-system-service. Efraim Flashner 2020-02-07services: inputattach: Fix broken baud rate option....* gnu/services/desktop.scm (inputattach-shepherd-service): Use "--baud" for setting the baud-rate. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> Tim Gesthuizen 2020-01-21services: sane: Create the "scanner" account....* gnu/services/desktop.scm (%sane-accounts, sane-service-type): New variables. (%desktop-services): Use SANE-SERVICE-TYPE instead of 'simple-service'. * doc/guix.texi (Desktop Services): Document 'sane-service-type'. Ludovic Courtès 2020-01-20services: Add "sane" service....* gnu/services/desktop.scm (%desktop-services): Add "sane" service. Danny Milosavljevic 2020-01-11services: Add pulseaudio to %desktop-services....Fixes <https://bugs.gnu.org/38172>. Reported by raingloom <raingloom@riseup.net>. * gnu/services/desktop.scm (%desktop-services): Add pulseaudio service. Signed-off-by: Marius Bakke <mbakke@fastmail.com> Leo Prikler 2019-12-04services: Add GNOME Keyring service....* gnu/services/desktop.scm: (<gnome-keyring-configuration>): New record type. (pam-gnome-keyring): New procedure. (gnome-keyring-service-type): New variable. * doc/guix.texi (Desktop Services): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Leo Prikler 2019-11-30services: Add polkit-wheel-service to %desktop-services....* gnu/services/desktop.scm: (%desktop-services): Add polkit-wheel-service. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Leo Prikler 2019-11-30services: Add polkit-wheel-service....* gnu/services/desktop.scm: (polkit-wheel): New variable. (polkit-wheel-service): New service. * doc/guix.texi: Document polkit-wheel-service. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Leo Prikler 2019-11-01services: colord: Deprecate 'colord-service' procedure....* gnu/services/desktop.scm (colord-service-type)[default-value]: New field. (colord-service): Define with 'define-deprecated'. (%desktop-services): Use 'colord-service-type' instead of 'colord-service'. * doc/guix.texi (Desktop Services): Adjust accordingly. Ludovic Courtès 2019-10-22services: elogind, gnome, mate, xfce: Fix config type predicate identifiers....* gnu/services/desktop.scm (<elogind-configuration>): Add question mark in type predicate identifier. (<gnome-desktop-configuration>): Likewise. (<mate-desktop-configuration>): Likewise. (<xfce-desktop-configuration>): Likewise. Ludovic Courtès 2019-10-21services: inputattach: Add 'baud-rate' parameter....* gnu/services/desktop.scm (inputattach-configuration): Add baud-rate field. (inputattach-shepherd-service): Add baud-rate to parameters when specified. * doc/guix.texi (Miscellaneous Services): [inputattach Service] Document baud-rate parameter. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Tim Gesthuizen 2019-10-20services: xfce: Add xfce4-power-manager to polkit settings....* gnu/services/desktop.scm (xfce-desktop-service-type): Add xfce4-power-manager to polkit-service-type service extension via new procedure 'xfce-polkit-settings'. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> David Wilson 2019-08-28gnu: enlightenment: Update to 0.23.0....* gnu/packages/enlightenment.scm (enlightenment): Update to 0.23.0. [build-system]: Switch to meson-build-system. [arguments]: Add configure-flag to build without systemd. Remove 'bootstrap phase. Update substitutions in custom 'set-system-actions phase. [inputs]: Add bluez, pulseaudio. * gnu/packages/patches/enlightenment-fix-setuid-path.patch: Update. * gnu/services/desktop.scm (enlightenment-setuid-programs): Update location of 'freqset binary. Add 'cpuclock_sys to setuid binaries. Efraim Flashner 2019-06-15services: Include USB_ModeSwitch in %desktop-services....Fixes <https://bugs.gnu.org/35640>. * gnu/services/desktop.scm (%desktop-services): Add usb-modeswitch-service-type. * doc/guix.texi (Networking Services): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Florian Pelz 2019-05-15services: Include ModemManager in %desktop-services....* gnu/services/desktop.scm (%desktop-services): Add modem-manager-service-type. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Florian Pelz 2019-05-14services: Add 'network-manager-applet' to %DESKTOP-SERVICES....Fixes <https://bugs.gnu.org/35554>. Reported by Calle Kabo <calle@kabo.nu>. * gnu/services/desktop.scm (%desktop-services): Add 'network-manager-applet' service. Ludovic Courtès 2019-04-30services: colord: Make public and searchable....* gnu/services/desktop.scm (colord-service-type): Make public. [description]: New field. Ludovic Courtès 2019-04-30services: bluetooth: Make public and searchable....Until now 'guix system search bluetooth' would turn up nothing. * gnu/services/desktop.scm (bluetooth-service-type) (bluetooth-configuration): Make public. (bluetooth-service-type)[description]: New field. Ludovic Courtès 2019-04-26services: cups-pk-helper: Export....* gnu/services/desktop.scm (cups-pk-helper-service-type): Export. Ludovic Courtès