From 1d61c9e816384424ab5a1777425544f084113f06 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Wed, 19 Feb 2020 17:36:29 -0500 Subject: [PATCH 01/22] Test code coverage reporting --- .travis.yml | 71 +++++++++++++++++++++++++++++++--------------------- package.json | 7 +++++- 2 files changed, 49 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index a6f396bcd..c676eb6f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,34 +9,49 @@ before_install: - git submodule update --init --recursive # End submodules fix node_js: -- '10' -env: -- DEMOS="TRUE" -- TEST_NAME='base' TEST_SUITE='' -- TEST_NAME='bigNumber' TEST_SUITE='' -- TEST_NAME='negativeNumber' TEST_SUITE='' -- TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' -- TEST_NAME='restAPI' TEST_SUITE='' -- TEST_NAME='bits' TEST_SUITE='' -- TEST_NAME='fixedpoint' TEST_SUITE='share' -- TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' -- TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' -- TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' -- TEST_NAME='fixedpoint' TEST_SUITE='comparison' -- TEST_NAME='fixedpoint' TEST_SUITE='ifelse' -- TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' -- TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' -- TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' -- TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' -- TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' -- TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' -script: -- while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & -- if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run test -- "$TEST_NAME" "$TEST_SUITE"; fi -- kill %1 -cache: - directories: - - node_modules + - '10' +jobs: + include: + - stage: SETUP + script: mkdir .nyc_output + workspaces: + create: + name: coverage + paths: + - ./.nyc_output + - stage: TEST + env: + - DEMOS="TRUE" + - TEST_NAME='base' TEST_SUITE='' + - TEST_NAME='bigNumber' TEST_SUITE='' + - TEST_NAME='negativeNumber' TEST_SUITE='' + - TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' + - TEST_NAME='restAPI' TEST_SUITE='' + - TEST_NAME='bits' TEST_SUITE='' + - TEST_NAME='fixedpoint' TEST_SUITE='share' + - TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' + - TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' + - TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' + - TEST_NAME='fixedpoint' TEST_SUITE='comparison' + - TEST_NAME='fixedpoint' TEST_SUITE='ifelse' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' + script: + - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & + - if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi + - kill %1 + workspaces: + use: coverage + - stage: REPORT + script: npm run coverage:report + workspaces: + use: coverage + + notifications: slack: secure: DuaE/q/B/la8rNGXsn/p3owtWZmn6th1rAJUXTIUUU48OjE86ehzMD40JMLMyAty3f/NHYOPufS7//AfpaIf4cGE6/4wHcTVoLOzRv6aP7WM0SvMy1WS5QgP7ryIjciyXFczknQ+JSMcXlxQDKtMCT7wBIwQO1WrB+T8e617y575t/ofO39k9Za1NA81MlrdWxTIWTDGMo17T+Pd/zz4ImHGYoifUzXi9DdH/4Zgy9SJxWQJ3PO/5RWef4qu1mBGXdanIEd63mYjIIQh8nJLn3pvWp7rQnChmwRqURDc6hpwdPJqeWO5knqhNlu/u7/TJI985rvTOPYljXfReXdF1OEHuq+prWGhv4VbxJzTpQ9PJZ42Ac1k6nCaMCJfCphpsUL48+qgeRY9IyBoqARw4Ne8hTerc7P0T/iQxgZk8zVVahdf0C27sPD0B563gMWvFKxW41YbvHwku7CpReaCt+pcGTd77p+v0mGZGlWNv/kV6KXMBHmQXGYEdVSpscEdlFbByZKagY8lrsadyZtaAaUCdD4VRGaYCWPh/+eBsVdS94r7XRHXBceiSd3ZY093r7lMO9yGnyDwqSydL7JgncO/GxWMhsEz2vRV+bgZlLU2yo60H8Kg1jvmpVP3o0d8wfkDUyLVOkJiSDZ+LuhQZ10f1MnP3AtVrMJFEKITmqw= diff --git a/package.json b/package.json index f419fb043..ef730669c 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,8 @@ "scripts": { "test": "./tests/suite/test.sh", "suite": "./tests/suite/suite.sh", + "coverage": "nyc --no-clean npm run test", + "coverage:report": "nyc report --reporter=text-lcov | coveralls", "gen-docs": "./node_modules/.bin/jsdoc -r -c docs/jsdoc.conf.json && sed -i -e 's/lib\\/ext\\/README.md/extensions.html/g' docs/jsdoc/*.html && sed -i -e 's/lib\\/ext\\/Hooks.md/hooks.html/g' docs/jsdoc/*.html && sed -i -e 's/Hooks.md/hooks.html/g' docs/jsdoc/*.html && sed -i -e 's/CONTRIBUTING.md/CONTRIBUTING.html/g' docs/jsdoc/*.html", "test-demo": "./demos/run-test.sh", "fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit", @@ -66,6 +68,7 @@ "devDependencies": { "browserify": "^16.5.0", "chai": "^4.1.2", + "coveralls": "^3.0.9", "eslint": "^4.19.1", "eslint-plugin-requirejs": "^2.0.1", "express": "^4.16.3", @@ -73,6 +76,8 @@ "marked": "^0.7.0", "minimist": "^1.2.0", "mocha": "^4.0.1", - "neptune-notebook": "^1.1.1" + "mocha-lcov-reporter": "^1.3.0", + "neptune-notebook": "^1.1.1", + "nyc": "^15.0.0" } } From 32a76cf77be63b4d557e64e4061135dc3b65196d Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Wed, 19 Feb 2020 17:51:29 -0500 Subject: [PATCH 02/22] Try again with matrix expansion --- .travis.yml | 65 ++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index c676eb6f2..680cae3bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,48 +10,53 @@ before_install: # End submodules fix node_js: - '10' +# Make sure setup runs before test stage +# Test stage is implicitly defined and makes use of matrix expansion +stages: + - setup + - test + - report +env: + - DEMOS="TRUE" + - TEST_NAME='base' TEST_SUITE='' + - TEST_NAME='bigNumber' TEST_SUITE='' + - TEST_NAME='negativeNumber' TEST_SUITE='' + - TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' + - TEST_NAME='restAPI' TEST_SUITE='' + - TEST_NAME='bits' TEST_SUITE='' + - TEST_NAME='fixedpoint' TEST_SUITE='share' + - TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' + - TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' + - TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' + - TEST_NAME='fixedpoint' TEST_SUITE='comparison' + - TEST_NAME='fixedpoint' TEST_SUITE='ifelse' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' + - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' +script: + - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & + - if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi + - kill %1 + workspaces: + use: coverage + jobs: include: - - stage: SETUP + - stage: setup script: mkdir .nyc_output workspaces: create: name: coverage paths: - ./.nyc_output - - stage: TEST - env: - - DEMOS="TRUE" - - TEST_NAME='base' TEST_SUITE='' - - TEST_NAME='bigNumber' TEST_SUITE='' - - TEST_NAME='negativeNumber' TEST_SUITE='' - - TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' - - TEST_NAME='restAPI' TEST_SUITE='' - - TEST_NAME='bits' TEST_SUITE='' - - TEST_NAME='fixedpoint' TEST_SUITE='share' - - TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' - - TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' - - TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' - - TEST_NAME='fixedpoint' TEST_SUITE='comparison' - - TEST_NAME='fixedpoint' TEST_SUITE='ifelse' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' - script: - - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & - - if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi - - kill %1 - workspaces: - use: coverage - - stage: REPORT + - stage: report script: npm run coverage:report workspaces: use: coverage - notifications: slack: secure: DuaE/q/B/la8rNGXsn/p3owtWZmn6th1rAJUXTIUUU48OjE86ehzMD40JMLMyAty3f/NHYOPufS7//AfpaIf4cGE6/4wHcTVoLOzRv6aP7WM0SvMy1WS5QgP7ryIjciyXFczknQ+JSMcXlxQDKtMCT7wBIwQO1WrB+T8e617y575t/ofO39k9Za1NA81MlrdWxTIWTDGMo17T+Pd/zz4ImHGYoifUzXi9DdH/4Zgy9SJxWQJ3PO/5RWef4qu1mBGXdanIEd63mYjIIQh8nJLn3pvWp7rQnChmwRqURDc6hpwdPJqeWO5knqhNlu/u7/TJI985rvTOPYljXfReXdF1OEHuq+prWGhv4VbxJzTpQ9PJZ42Ac1k6nCaMCJfCphpsUL48+qgeRY9IyBoqARw4Ne8hTerc7P0T/iQxgZk8zVVahdf0C27sPD0B563gMWvFKxW41YbvHwku7CpReaCt+pcGTd77p+v0mGZGlWNv/kV6KXMBHmQXGYEdVSpscEdlFbByZKagY8lrsadyZtaAaUCdD4VRGaYCWPh/+eBsVdS94r7XRHXBceiSd3ZY093r7lMO9yGnyDwqSydL7JgncO/GxWMhsEz2vRV+bgZlLU2yo60H8Kg1jvmpVP3o0d8wfkDUyLVOkJiSDZ+LuhQZ10f1MnP3AtVrMJFEKITmqw= From 82e59f8ff6a189bf2ff3a75d8195554656440115 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Wed, 19 Feb 2020 17:57:54 -0500 Subject: [PATCH 03/22] Fix yml file --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 680cae3bb..b2971d940 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,8 +40,8 @@ script: - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & - if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi - kill %1 - workspaces: - use: coverage +workspaces: + use: coverage jobs: include: From 650aa23f809ff5daed54281e436e17da7b545ea0 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Thu, 20 Feb 2020 13:03:37 -0500 Subject: [PATCH 04/22] Debug travis workspace issue --- .travis.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2971d940..71e1bbd0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,24 +17,7 @@ stages: - test - report env: - - DEMOS="TRUE" - - TEST_NAME='base' TEST_SUITE='' - - TEST_NAME='bigNumber' TEST_SUITE='' - - TEST_NAME='negativeNumber' TEST_SUITE='' - - TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' - - TEST_NAME='restAPI' TEST_SUITE='' - - TEST_NAME='bits' TEST_SUITE='' - - TEST_NAME='fixedpoint' TEST_SUITE='share' - - TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' - - TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' - - TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' - - TEST_NAME='fixedpoint' TEST_SUITE='comparison' - TEST_NAME='fixedpoint' TEST_SUITE='ifelse' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' script: - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & @@ -53,7 +36,10 @@ jobs: paths: - ./.nyc_output - stage: report - script: npm run coverage:report + script: + - ls -la + - ls -la .nyc_output + - npm run coverage:report workspaces: use: coverage From e272e65acd298f3a0ee1946486cc19a60f9d7439 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Thu, 20 Feb 2020 14:14:57 -0500 Subject: [PATCH 05/22] Debug travis workspace issue --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 71e1bbd0d..ab8d42edd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,8 @@ script: - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & - if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi - kill %1 + - ls -la + - ls -la .nyc_output workspaces: use: coverage @@ -34,7 +36,7 @@ jobs: create: name: coverage paths: - - ./.nyc_output + - .nyc_output - stage: report script: - ls -la From 77525e6ae52a82b091e667c6240d77375c1b53b6 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Thu, 20 Feb 2020 14:25:17 -0500 Subject: [PATCH 06/22] Debug travis workspace issue --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ab8d42edd..b1aff464f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,6 @@ workspaces: jobs: include: - stage: setup - script: mkdir .nyc_output workspaces: create: name: coverage From 1661ba3a822f25876b9247ee136e84fda71fca67 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Thu, 20 Feb 2020 14:32:32 -0500 Subject: [PATCH 07/22] Debug travis workspace issue --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b1aff464f..69336291b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,7 @@ workspaces: jobs: include: - stage: setup + script: ls -la workspaces: create: name: coverage From 2e683beffe530e9f2cd4efcac453bab0da712528 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Thu, 20 Feb 2020 14:34:35 -0500 Subject: [PATCH 08/22] Debug travis workspace issue --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 69336291b..132ffcbc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ workspaces: jobs: include: - stage: setup - script: ls -la + script: mkdir .nyc_output && touch .nyc_output/file workspaces: create: name: coverage From 75e59e789e5fa60d566df298b5ac6b907d60f664 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Thu, 20 Feb 2020 15:21:53 -0500 Subject: [PATCH 09/22] Debug travis workspace issue --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 132ffcbc1..57a47d934 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,10 @@ script: - ls -la - ls -la .nyc_output workspaces: - use: coverage + create: + name: coverage + paths: + - .nyc_output jobs: include: From 433d93e119fbea4fa7d5cb2e07c03c6c1c9beea8 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Sun, 23 Feb 2020 22:14:46 -0500 Subject: [PATCH 10/22] Test different workspaces --- .travis.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57a47d934..34f8dabd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,20 +16,12 @@ stages: - setup - test - report -env: - - TEST_NAME='fixedpoint' TEST_SUITE='ifelse' - - TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' script: - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & - if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi - kill %1 - ls -la - ls -la .nyc_output -workspaces: - create: - name: coverage - paths: - - .nyc_output jobs: include: @@ -40,13 +32,30 @@ jobs: name: coverage paths: - .nyc_output + - stage: test + name: 1 + env: TEST_NAME='fixedpoint' TEST_SUITE='ifelse' + workspaces: + create: + name: 1 + paths: + - .nyc_output + name: 2 + env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' + workspaces: + create: + name: 2 + paths: + - .nyc_output - stage: report script: - ls -la - ls -la .nyc_output - npm run coverage:report workspaces: - use: coverage + use: + - 1 + - 2 notifications: slack: From f2b874bee055812c690df4d5e32ea1edeabdf36d Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Sun, 23 Feb 2020 22:17:27 -0500 Subject: [PATCH 11/22] Test different workspaces --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 34f8dabd1..271563e27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ jobs: name: 1 paths: - .nyc_output - name: 2 + - name: 2 env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' workspaces: create: From b277f47b178e76c067eb19cdb215b49e6aa1a74c Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Sun, 23 Feb 2020 22:29:24 -0500 Subject: [PATCH 12/22] Try adding all jobs again --- .travis.yml | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 138 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 271563e27..64d57894d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,19 +34,138 @@ jobs: - .nyc_output - stage: test name: 1 - env: TEST_NAME='fixedpoint' TEST_SUITE='ifelse' + env: DEMOS="TRUE" workspaces: create: name: 1 paths: - .nyc_output - name: 2 - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' + env: TEST_NAME='base' TEST_SUITE='' workspaces: create: name: 2 paths: - .nyc_output + - name: 3 + env: TEST_NAME='bigNumber' TEST_SUITE='' + workspaces: + create: + name: 3 + paths: + - .nyc_output + - name: 4 + env: TEST_NAME='negativeNumber' TEST_SUITE='' + workspaces: + create: + name: 4 + paths: + - .nyc_output + - name: 5 + env: TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' + workspaces: + create: + name: 5 + paths: + - .nyc_output + - name: 6 + env: TEST_NAME='restAPI' TEST_SUITE='' + workspaces: + create: + name: 6 + paths: + - .nyc_output + - name: 7 + env: TEST_NAME='bits' TEST_SUITE='' + workspaces: + create: + name: 7 + paths: + - .nyc_output + - name: 8 + env: TEST_NAME='fixedpoint' TEST_SUITE='share' + workspaces: + create: + name: 8 + paths: + - .nyc_output + - name: 9 + env: TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' + workspaces: + create: + name: 9 + paths: + - .nyc_output + - name: 10 + env: TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' + workspaces: + create: + name: 10 + paths: + - .nyc_output + - name: 11 + env: TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' + workspaces: + create: + name: 11 + paths: + - .nyc_output + - name: 12 + env: TEST_NAME='fixedpoint' TEST_SUITE='comparison' + workspaces: + create: + name: 12 + paths: + - .nyc_output + - name: 13 + env: TEST_NAME='fixedpoint' TEST_SUITE='ifelse' + workspaces: + create: + name: 13 + paths: + - .nyc_output + - name: 14 + env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' + workspaces: + create: + name: 14 + paths: + - .nyc_output + - name: 15 + env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' + workspaces: + create: + name: 15 + paths: + - .nyc_output + - name: 16 + env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' + workspaces: + create: + name: 16 + paths: + - .nyc_output + - name: 17 + env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' + workspaces: + create: + name: 17 + paths: + - .nyc_output + - name: 18 + env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' + workspaces: + create: + name: 18 + paths: + - .nyc_output + - name: 19 + env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' + workspaces: + create: + name: 19 + paths: + - .nyc_output - stage: report script: - ls -la @@ -56,6 +175,23 @@ jobs: use: - 1 - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 11 + - 12 + - 13 + - 14 + - 15 + - 16 + - 17 + - 18 + - 19 notifications: slack: From 7457a2fe9405fb4dd9978addf3788703bf851369 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Sun, 23 Feb 2020 22:47:51 -0500 Subject: [PATCH 13/22] Remove debug code and rename jobs --- .travis.yml | 58 ++++++++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index 64d57894d..efdb7cd36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,156 +10,141 @@ before_install: # End submodules fix node_js: - '10' -# Make sure setup runs before test stage -# Test stage is implicitly defined and makes use of matrix expansion -stages: - - setup - - test - - report script: - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & - if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi - kill %1 - - ls -la - - ls -la .nyc_output jobs: include: - - stage: setup - script: mkdir .nyc_output && touch .nyc_output/file - workspaces: - create: - name: coverage - paths: - - .nyc_output - stage: test - name: 1 + name: DEMOS="TRUE" env: DEMOS="TRUE" workspaces: create: name: 1 paths: - .nyc_output - - name: 2 + - name: TEST_NAME='base' TEST_SUITE='' env: TEST_NAME='base' TEST_SUITE='' workspaces: create: name: 2 paths: - .nyc_output - - name: 3 + - name: TEST_NAME='bigNumber' TEST_SUITE='' env: TEST_NAME='bigNumber' TEST_SUITE='' workspaces: create: name: 3 paths: - .nyc_output - - name: 4 + - name: TEST_NAME='negativeNumber' TEST_SUITE='' env: TEST_NAME='negativeNumber' TEST_SUITE='' workspaces: create: name: 4 paths: - .nyc_output - - name: 5 + - name: TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' env: TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' workspaces: create: name: 5 paths: - .nyc_output - - name: 6 + - name: TEST_NAME='restAPI' TEST_SUITE='' env: TEST_NAME='restAPI' TEST_SUITE='' workspaces: create: name: 6 paths: - .nyc_output - - name: 7 + - name: TEST_NAME='bits' TEST_SUITE='' env: TEST_NAME='bits' TEST_SUITE='' workspaces: create: name: 7 paths: - .nyc_output - - name: 8 + - name: TEST_NAME='fixedpoint' TEST_SUITE='share' env: TEST_NAME='fixedpoint' TEST_SUITE='share' workspaces: create: name: 8 paths: - .nyc_output - - name: 9 + - name: TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' env: TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' workspaces: create: name: 9 paths: - .nyc_output - - name: 10 + - name: TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' env: TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' workspaces: create: name: 10 paths: - .nyc_output - - name: 11 + - name: TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' env: TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' workspaces: create: name: 11 paths: - .nyc_output - - name: 12 + - name: TEST_NAME='fixedpoint' TEST_SUITE='comparison' env: TEST_NAME='fixedpoint' TEST_SUITE='comparison' workspaces: create: name: 12 paths: - .nyc_output - - name: 13 + - name: TEST_NAME='fixedpoint' TEST_SUITE='ifelse' env: TEST_NAME='fixedpoint' TEST_SUITE='ifelse' workspaces: create: name: 13 paths: - .nyc_output - - name: 14 + - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' workspaces: create: name: 14 paths: - .nyc_output - - name: 15 + - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' workspaces: create: name: 15 paths: - .nyc_output - - name: 16 + - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' workspaces: create: name: 16 paths: - .nyc_output - - name: 17 + - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' workspaces: create: name: 17 paths: - .nyc_output - - name: 18 + - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' workspaces: create: name: 18 paths: - .nyc_output - - name: 19 + - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' workspaces: create: @@ -167,10 +152,7 @@ jobs: paths: - .nyc_output - stage: report - script: - - ls -la - - ls -la .nyc_output - - npm run coverage:report + script: npm run coverage:report workspaces: use: - 1 From 36a9fb3c8a48778d610a9e87a3313227d6392bf8 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Fri, 28 Feb 2020 11:42:40 -0500 Subject: [PATCH 14/22] Try without naming jobs --- .travis.yml | 61 ++++++++++++++++------------------------------------- 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/.travis.yml b/.travis.yml index efdb7cd36..f2af71ad9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,134 +18,110 @@ script: jobs: include: - stage: test - name: DEMOS="TRUE" env: DEMOS="TRUE" - workspaces: - create: - name: 1 - paths: - - .nyc_output - - name: TEST_NAME='base' TEST_SUITE='' - env: TEST_NAME='base' TEST_SUITE='' + - env: TEST_NAME='base' TEST_SUITE='' workspaces: create: name: 2 paths: - .nyc_output - - name: TEST_NAME='bigNumber' TEST_SUITE='' - env: TEST_NAME='bigNumber' TEST_SUITE='' + - env: TEST_NAME='bigNumber' TEST_SUITE='' workspaces: create: name: 3 paths: - .nyc_output - - name: TEST_NAME='negativeNumber' TEST_SUITE='' - env: TEST_NAME='negativeNumber' TEST_SUITE='' + - env: TEST_NAME='negativeNumber' TEST_SUITE='' workspaces: create: name: 4 paths: - .nyc_output - - name: TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' - env: TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' + - env: TEST_NAME='bigNumber-negativeNumber' TEST_SUITE='' workspaces: create: name: 5 paths: - .nyc_output - - name: TEST_NAME='restAPI' TEST_SUITE='' - env: TEST_NAME='restAPI' TEST_SUITE='' + - env: TEST_NAME='restAPI' TEST_SUITE='' workspaces: create: name: 6 paths: - .nyc_output - - name: TEST_NAME='bits' TEST_SUITE='' - env: TEST_NAME='bits' TEST_SUITE='' + - env: TEST_NAME='bits' TEST_SUITE='' workspaces: create: name: 7 paths: - .nyc_output - - name: TEST_NAME='fixedpoint' TEST_SUITE='share' - env: TEST_NAME='fixedpoint' TEST_SUITE='share' + - env: TEST_NAME='fixedpoint' TEST_SUITE='share' workspaces: create: name: 8 paths: - .nyc_output - - name: TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' - env: TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' + - env: TEST_NAME='fixedpoint' TEST_SUITE='arithmetic' workspaces: create: name: 9 paths: - .nyc_output - - name: TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' - env: TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' + - env: TEST_NAME='fixedpoint' TEST_SUITE='constant arithmetic' workspaces: create: name: 10 paths: - .nyc_output - - name: TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' - env: TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' + - env: TEST_NAME='fixedpoint' TEST_SUITE='constant comparison' workspaces: create: name: 11 paths: - .nyc_output - - name: TEST_NAME='fixedpoint' TEST_SUITE='comparison' - env: TEST_NAME='fixedpoint' TEST_SUITE='comparison' + - env: TEST_NAME='fixedpoint' TEST_SUITE='comparison' workspaces: create: name: 12 paths: - .nyc_output - - name: TEST_NAME='fixedpoint' TEST_SUITE='ifelse' - env: TEST_NAME='fixedpoint' TEST_SUITE='ifelse' + - env: TEST_NAME='fixedpoint' TEST_SUITE='ifelse' workspaces: create: name: 13 paths: - .nyc_output - - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' + - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='share' workspaces: create: name: 14 paths: - .nyc_output - - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' + - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='arithmetic' workspaces: create: name: 15 paths: - .nyc_output - - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' + - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant arithmetic' workspaces: create: name: 16 paths: - .nyc_output - - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' + - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='constant comparison' workspaces: create: name: 17 paths: - .nyc_output - - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' + - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='comparison' workspaces: create: name: 18 paths: - .nyc_output - - name: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' + - env: TEST_NAME='fixedpoint-negativeNumber' TEST_SUITE='ifelse' workspaces: create: name: 19 @@ -155,7 +131,6 @@ jobs: script: npm run coverage:report workspaces: use: - - 1 - 2 - 3 - 4 From c5f45aa16dbb37f1293f973adb2520fc6a72dfdb Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Fri, 28 Feb 2020 11:50:40 -0500 Subject: [PATCH 15/22] Add Coveralls badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 49165bbce..f3c2ff30d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # JIFF [![Build Status](https://travis-ci.org/multiparty/jiff.svg?branch=master)](https://travis-ci.org/multiparty/jiff) +[![Coverage Status](https://coveralls.io/repos/github/multiparty/jiff/badge.svg?branch=coveralls)](https://coveralls.io/github/multiparty/jiff?branch=coveralls) JIFF is a JavaScript library for building applications that rely on secure multi-party computation. JIFF is built to be highly flexible with a focus on usability, with the ability to be run in the browser, on mobile phones, or via Node.js. JIFF is designed so that developers need not be familiar with MPC techniques or know the details of cryptographic protocols in order to build secure applications. From 75af73ad7a0169bbfaed4e4599e5b03985d8f9a7 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Fri, 28 Feb 2020 11:51:57 -0500 Subject: [PATCH 16/22] Remove specific branch from badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3c2ff30d..388bfcd87 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # JIFF [![Build Status](https://travis-ci.org/multiparty/jiff.svg?branch=master)](https://travis-ci.org/multiparty/jiff) -[![Coverage Status](https://coveralls.io/repos/github/multiparty/jiff/badge.svg?branch=coveralls)](https://coveralls.io/github/multiparty/jiff?branch=coveralls) +[![Coverage Status](https://coveralls.io/repos/github/multiparty/jiff/badge.svg)](https://coveralls.io/github/multiparty/jiff) JIFF is a JavaScript library for building applications that rely on secure multi-party computation. JIFF is built to be highly flexible with a focus on usability, with the ability to be run in the browser, on mobile phones, or via Node.js. JIFF is designed so that developers need not be familiar with MPC techniques or know the details of cryptographic protocols in order to build secure applications. From 6fe5ae4d8827de31b27c966d41b67b9d00b460ea Mon Sep 17 00:00:00 2001 From: Kinan Dak Al Bab Date: Thu, 19 Mar 2020 23:33:28 -0400 Subject: [PATCH 17/22] Add demo tests to coveralls --- .travis.yml | 8 +++++++- package.json | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f2af71ad9..21e76d7b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,18 @@ node_js: - '10' script: - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & - - if [ "$DEMOS" == "TRUE" ]; then npm run-script test-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi + - if [ "$DEMOS" == "TRUE" ]; then npm run coverage-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi - kill %1 jobs: include: - stage: test env: DEMOS="TRUE" + workspaces: + create: + name: 1 + paths: + - .nyc_output - env: TEST_NAME='base' TEST_SUITE='' workspaces: create: @@ -131,6 +136,7 @@ jobs: script: npm run coverage:report workspaces: use: + - 1 - 2 - 3 - 4 diff --git a/package.json b/package.json index c1d015d12..999c3714c 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "coverage:report": "nyc report --reporter=text-lcov | coveralls", "gen-docs": "./node_modules/.bin/jsdoc -r -c docs/jsdoc.conf.json && sed -i -e 's/lib\\/ext\\/README.md/extensions.html/g' docs/jsdoc/*.html && sed -i -e 's/lib\\/ext\\/Hooks.md/hooks.html/g' docs/jsdoc/*.html && sed -i -e 's/Hooks.md/hooks.html/g' docs/jsdoc/*.html && sed -i -e 's/CONTRIBUTING.md/CONTRIBUTING.html/g' docs/jsdoc/*.html", "test-demo": "./demos/run-test.sh", + "coverage-demo": "nyc --no-clean npm run test-demo", "fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit", "lint": "./node_modules/.bin/eslint .", "tutorial": "npm install && cd tutorials && node index.js", From b562cde0bf8760cea225ead16c759ca918daf0e1 Mon Sep 17 00:00:00 2001 From: Kinan Dak Al Bab Date: Fri, 20 Mar 2020 22:01:33 -0400 Subject: [PATCH 18/22] testing travis after_failure hook --- .travis.yml | 6 ++++++ demos/run-test.sh | 1 + lib/server/handlers.js | 1 + tests/suite/index.js | 1 + 4 files changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 21e76d7b0..948f8b6ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,12 @@ before_install: - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules - git submodule update --init --recursive # End submodules fix +after_failure: + - echo "AFTER FAILURE" + - echo $DEMOS + - echo $TEST_NAME + - echo $TEST_SUITE + node_js: - '10' script: diff --git a/demos/run-test.sh b/demos/run-test.sh index 0a922e3ae..141201c2a 100755 --- a/demos/run-test.sh +++ b/demos/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +exit "1" mkdir -p logs diff --git a/lib/server/handlers.js b/lib/server/handlers.js index 047d2e0f0..e0359d96d 100644 --- a/lib/server/handlers.js +++ b/lib/server/handlers.js @@ -230,6 +230,7 @@ module.exports = function (jiffServer) { jiffServer.handlers.free = function (computation_id, party_id, msg) { jiffServer.hooks.log(jiffServer, 'free', computation_id, '-', party_id); + console.log('free', computation_id, '-', party_id); try { jiffServer.hooks.execute_array_hooks('beforeFree', [jiffServer, computation_id, party_id, msg], -1); diff --git a/tests/suite/index.js b/tests/suite/index.js index a803f8599..b4791b9bd 100644 --- a/tests/suite/index.js +++ b/tests/suite/index.js @@ -1,4 +1,5 @@ /* global describe it */ +while (true) {}; var helpers = require('./config/bigNumber/helpers.js'); // Catch and log any uncaught exceptions From 8e38deec9c1190d7b360a8fe824026e7c2b055c7 Mon Sep 17 00:00:00 2001 From: Kinan Dak Al Bab Date: Fri, 20 Mar 2020 23:14:42 -0400 Subject: [PATCH 19/22] Improve logs in tests and dump logs in travis on failure or timeout --- .dump_log.sh | 32 ++++++++++++++++++++++++++++++++ .eslintignore | 5 +++-- .gitignore | 3 +++ .travis.yml | 7 ++----- demos/mpc-as-a-service/server.js | 7 ++++++- demos/run-test.sh | 14 +++++++++++++- demos/threshold/server.js | 12 +++++++++++- demos/web-mpc/server.js | 7 +++++++ lib/server/handlers.js | 11 +++++------ tests/suite/index.js | 1 - tests/suite/server.js | 11 +++++++++-- tutorials/index.js | 15 +++------------ 12 files changed, 94 insertions(+), 31 deletions(-) create mode 100755 .dump_log.sh diff --git a/.dump_log.sh b/.dump_log.sh new file mode 100755 index 000000000..1ce77e4c5 --- /dev/null +++ b/.dump_log.sh @@ -0,0 +1,32 @@ +#!/bin/bash +echo "FAILED" + +if [[ $DEMOS == "TRUE" ]]; then + # dump all logs marked as failed, or in .lastlog (timedout) + FAILED_LOGS=$(cat '.failedlogs') + LAST_LOG=$(cat '.lastlog') + + for log in $FAILED_LOGS; do + if [[ $log != "" ]]; then + cat "Failed logs: $log" + head $log + echo "----------------" + echo "" + fi + done + + for log in LAST_LOG; do + if [[ $log != "" ]]; then + echo "Timedout logs:" + cat $log + echo "----------------" + echo "" + fi + done +else + # dump the test suite log + if [[ TEST_SUITE == '' ]]; then + TEST_SUITE='suite' + fi + cat "tests/suite/logs/${TEST_NAME}/${TEST_SUITE}.log" +fi \ No newline at end of file diff --git a/.eslintignore b/.eslintignore index 3c40020f1..c02e0dd16 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ -**/node_modules/ +node_modules/ docs/ -demos/routing/data/* +dist/ +tutorials/static/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index e65b67cc3..09457e626 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.failedlogs +.lastlog + package-lock.json jiffclient.vim *.DS_Store diff --git a/.travis.yml b/.travis.yml index 948f8b6ee..85c94022a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,16 +9,13 @@ before_install: - git submodule update --init --recursive # End submodules fix after_failure: - - echo "AFTER FAILURE" - - echo $DEMOS - - echo $TEST_NAME - - echo $TEST_SUITE + - ./.dumo_log.sh node_js: - '10' script: - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & - - if [ "$DEMOS" == "TRUE" ]; then npm run coverage-demo -- \*; else npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi + - if [ "$DEMOS" == "TRUE" ]; then timeout -s9 48m npm run coverage-demo -- \*; else timeout -s9 48m npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi - kill %1 jobs: diff --git a/demos/mpc-as-a-service/server.js b/demos/mpc-as-a-service/server.js index f9ec0d862..3f0d3bbf4 100644 --- a/demos/mpc-as-a-service/server.js +++ b/demos/mpc-as-a-service/server.js @@ -56,7 +56,12 @@ var options = { return params; } - ] + ], + log: function (_, label) { + if (['share', 'open', 'crypto_provider'].indexOf(label) === -1) { + console.log.apply(console, Array.from(arguments).slice(1)); + } + } } }; diff --git a/demos/run-test.sh b/demos/run-test.sh index 141201c2a..d93aa491f 100755 --- a/demos/run-test.sh +++ b/demos/run-test.sh @@ -1,9 +1,14 @@ #!/usr/bin/env bash -exit "1" mkdir -p logs +LASTLOG='.lastlog' +FAILEDLOGS='.failedlogs' + if [ "$1" == "*" ]; then + rm -f FAILEDLOGS + touch FAILEDLOGS + EXIT_CODE=0 for i in demos/*; do if [ -f "$i/test.js" ] || [ -f "$i/test.sh" ]; then @@ -22,7 +27,9 @@ else TESTDIR=${1%/} NAME=$(basename $TESTDIR) logs="logs/${NAME}.log" + echo "Server logs at ${logs}" + echo "$logs" > $LASTLOG if [ -f "$TESTDIR/test.sh" ]; then # demo has custom test bash script, run it @@ -46,6 +53,11 @@ else EXIT_CODE=$? kill $(ps aux | grep " ${TESTDIR}/server\.js" | awk '{ print $2}') + + echo "" > $LASTLOG + if [[ $EXIT_CODE != "0" ]]; then + echo "$logs" >> $FAILEDLOGS + fi exit "$EXIT_CODE" fi fi \ No newline at end of file diff --git a/demos/threshold/server.js b/demos/threshold/server.js index ca5a1c8dc..4c1b1d9c1 100644 --- a/demos/threshold/server.js +++ b/demos/threshold/server.js @@ -2,8 +2,18 @@ var path = require('path'); var express = require('express'); var app = express(); var http = require('http').Server(app); + var JIFFServer = require('../../lib/jiff-server'); -new JIFFServer(http, { logs:false }); +new JIFFServer(http, { + logs: false, + hooks: { + log: function (_, label) { + if (['share', 'open', 'crypto_provider'].indexOf(label) === -1) { + console.log.apply(console, Array.from(arguments).slice(1)); + } + } + } +}); // Serve static files. app.use('/demos', express.static(path.join(__dirname, '..', '..', 'demos'))); diff --git a/demos/web-mpc/server.js b/demos/web-mpc/server.js index 8b1fcd46e..7d4201659 100644 --- a/demos/web-mpc/server.js +++ b/demos/web-mpc/server.js @@ -14,6 +14,13 @@ var jiff_instance = new JIFFServer(http, { socketOptions: { pingTimeout: 1000, pingInterval: 2000 + }, + hooks: { + log: function (_, label) { + if (['share', 'open', 'crypto_provider'].indexOf(label) === -1) { + console.log.apply(console, Array.from(arguments).slice(1)); + } + } } }); jiff_instance.computationMaps.maxCount['web-mpc'] = 100000; // upper bound on how input parties can submit! diff --git a/lib/server/handlers.js b/lib/server/handlers.js index e0359d96d..a1e1c88e7 100644 --- a/lib/server/handlers.js +++ b/lib/server/handlers.js @@ -6,7 +6,7 @@ module.exports = function (jiffServer) { // initialize a party: either return an initialization message with the party id or an error message (e.g. if computation is full or requested id is taken) jiffServer.handlers.initializeParty = function (computation_id, party_id, party_count, msg, _s1) { - jiffServer.hooks.log(jiffServer, 'initialize with ', computation_id, '-', party_id, ' #', party_count, ' : ', msg, '::', _s1); + jiffServer.hooks.log(jiffServer, 'initialize ', computation_id, '-', party_id, ' #', party_count, ' : ', msg, '::', _s1); // s1 is reserved for server use only! if (_s1 !== true && party_id === 's1') { @@ -105,7 +105,7 @@ module.exports = function (jiffServer) { }; jiffServer.handlers.share = function (computation_id, from_id, msg) { - jiffServer.hooks.log(jiffServer, 'share from', computation_id, '-', from_id, ' : ', msg); + jiffServer.hooks.log(jiffServer, 'share', computation_id, '-', from_id, ' : ', msg); try { msg = jiffServer.hooks.execute_array_hooks('beforeOperation', [jiffServer, 'share', computation_id, from_id, msg], 4); @@ -123,7 +123,7 @@ module.exports = function (jiffServer) { }; jiffServer.handlers.open = function (computation_id, from_id, msg) { - jiffServer.hooks.log(jiffServer, 'open from', computation_id, '-', from_id, ' : ', msg); + jiffServer.hooks.log(jiffServer, 'open', computation_id, '-', from_id, ' : ', msg); try { msg = jiffServer.hooks.execute_array_hooks('beforeOperation', [jiffServer, 'open', computation_id, from_id, msg], 4); @@ -141,7 +141,7 @@ module.exports = function (jiffServer) { }; jiffServer.handlers.crypto_provider = function (computation_id, from_id, msg) { - jiffServer.hooks.log(jiffServer, 'crypto_provider from', computation_id, '-', from_id, ':', msg); + jiffServer.hooks.log(jiffServer, 'crypto_provider', computation_id, '-', from_id, ':', msg); try { msg = jiffServer.hooks.execute_array_hooks('beforeOperation', [jiffServer, 'crypto_provider', computation_id, from_id, msg], 4); @@ -210,7 +210,7 @@ module.exports = function (jiffServer) { }; jiffServer.handlers.custom = function (computation_id, from_id, msg) { - jiffServer.hooks.log(jiffServer, 'custom from', computation_id, '-', from_id, ':', msg); + jiffServer.hooks.log(jiffServer, 'custom', computation_id, '-', from_id, ':', msg); try { msg = jiffServer.hooks.execute_array_hooks('beforeOperation', [jiffServer, 'custom', computation_id, from_id, msg], 4); @@ -230,7 +230,6 @@ module.exports = function (jiffServer) { jiffServer.handlers.free = function (computation_id, party_id, msg) { jiffServer.hooks.log(jiffServer, 'free', computation_id, '-', party_id); - console.log('free', computation_id, '-', party_id); try { jiffServer.hooks.execute_array_hooks('beforeFree', [jiffServer, computation_id, party_id, msg], -1); diff --git a/tests/suite/index.js b/tests/suite/index.js index b4791b9bd..a803f8599 100644 --- a/tests/suite/index.js +++ b/tests/suite/index.js @@ -1,5 +1,4 @@ /* global describe it */ -while (true) {}; var helpers = require('./config/bigNumber/helpers.js'); // Catch and log any uncaught exceptions diff --git a/tests/suite/server.js b/tests/suite/server.js index 5f9ffdb21..a0de44c96 100644 --- a/tests/suite/server.js +++ b/tests/suite/server.js @@ -9,8 +9,15 @@ var jiffRestAPIServer = require('../../lib/ext/jiff-server-restful'); var jiffBigNumberServer = require('../../lib/ext/jiff-server-bignumber'); var options = { - logs: true, - app: app + logs: false, + app: app, + hooks: { + log: function (_, label) { + if (['share', 'open', 'crypto_provider'].indexOf(label) === -1) { + console.log.apply(console, Array.from(arguments).slice(1)); + } + } + } }; var jiff_instance = new jiffServer(http, options); diff --git a/tutorials/index.js b/tutorials/index.js index 9fff19a93..80582675b 100644 --- a/tutorials/index.js +++ b/tutorials/index.js @@ -20,24 +20,15 @@ neptune.addDocument('standard-deviation', '4-standarddev.md', true, jsDependenci neptune.addDocument('inner-product', '5-innerprod.md', true, jsDependencies); neptune.addDocument('preprocessing', '6-preprocessing.md', true, jsDependencies); neptune.addDocument('parallel', '7-parallel.md', true, jsDependencies); - -/* -neptune.writeHTML('MPC', 'demo/html/tutorial/0.html'); -neptune.writeHTML('intro', 'demo/html/tutorial/1.html'); -neptune.writeHTML('voting', 'demo/html/tutorial/2.html'); -neptune.writeHTML('binary-search', 'demo/html/tutorial/3.html'); -neptune.writeHTML('standard-deviation', 'demo/html/tutorial/4.html'); -neptune.writeHTML('inner-product', 'demo/html/tutorial/5.html'); -neptune.writeHTML('preprocessing', 'demo/html/tutorial/6.html'); -neptune.writeHTML('parallel', 'demo/html/tutorial/7.html'); -*/ - neptune.start(9111); global.neptune = neptune; global.app = neptune.app; global.server = neptune.server; +// eslint-disable-next-line no-undef app.use('/static', express.static('static/')); +// eslint-disable-next-line no-undef app.use('/lib', express.static('../lib/')); +// eslint-disable-next-line no-undef app.use('/dist', express.static('../dist/')); From 4e8d07d9fee0c499d00ed552c0a5371a5a49ae01 Mon Sep 17 00:00:00 2001 From: Kinan Dak Al Bab Date: Fri, 20 Mar 2020 23:26:12 -0400 Subject: [PATCH 20/22] fix typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 85c94022a..9d68ff25d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: - git submodule update --init --recursive # End submodules fix after_failure: - - ./.dumo_log.sh + - ./.dump_log.sh node_js: - '10' From 7f5bf6581d96f397a8b2d293a47e193d9c577a43 Mon Sep 17 00:00:00 2001 From: Kinan Dak Al Bab Date: Sat, 21 Mar 2020 14:01:21 -0400 Subject: [PATCH 21/22] Fix another typo in .dump_log.sh --- .dump_log.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.dump_log.sh b/.dump_log.sh index 1ce77e4c5..ce0c3dc08 100755 --- a/.dump_log.sh +++ b/.dump_log.sh @@ -6,6 +6,8 @@ if [[ $DEMOS == "TRUE" ]]; then FAILED_LOGS=$(cat '.failedlogs') LAST_LOG=$(cat '.lastlog') + echo "Failed logs: $FAILED_LOGS" + echo "=========================" for log in $FAILED_LOGS; do if [[ $log != "" ]]; then cat "Failed logs: $log" @@ -15,7 +17,9 @@ if [[ $DEMOS == "TRUE" ]]; then fi done - for log in LAST_LOG; do + echo "Timed out logs: $LAST_LOG" + echo "=========================" + for log in $LAST_LOG; do if [[ $log != "" ]]; then echo "Timedout logs:" cat $log From 03896b0d7852e05c3e87e75ec1a25cce6219f628 Mon Sep 17 00:00:00 2001 From: Frederick Jansen Date: Fri, 30 Oct 2020 10:53:59 -0400 Subject: [PATCH 22/22] Fix Travis demo command --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9d68ff25d..8f52b9915 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ node_js: - '10' script: - while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & - - if [ "$DEMOS" == "TRUE" ]; then timeout -s9 48m npm run coverage-demo -- \*; else timeout -s9 48m npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi + - if [ "$DEMOS" == "TRUE" ]; then timeout -s9 48m npm run coverage:demo -- \*; else timeout -s9 48m npm run coverage -- "$TEST_NAME" "$TEST_SUITE"; fi - kill %1 jobs: