Giter Club home page Giter Club logo

eshost-cli's Issues

Fatal error and core dumps is not displayed on output

Hi everyone,

A few days ago, I discovered this tool to help us on differential testing across engines.
I executed eshost with a code that throws a Fatal error and the output is nothing.
To explain I removed the icudtl.dat from V8 directory and use a test that call Date methods.

  • eshost -s date.js
#### Chakra, SpiderMonkey, V8

  • ~/.jsvu/v8 date.js
#
# Fatal error in , line 0
# Failed to create ICU date format, are ICU data files missing?
#
#
#
#FailureMessage Object: 0x7ffd9ff07310
==== C stack trace ===============================

    /home/.jsvu/engines/v8/v8(+0x2f5383) [0x56124b1dc383]
    /home/.jsvu/engines/v8/v8(+0x2f47fb) [0x56124b1db7fb]
    /home/.jsvu/engines/v8/v8(+0x2f0928) [0x56124b1d7928]
    /home/.jsvu/engines/v8/v8(+0x74b4df) [0x56124b6324df]
    /home/.jsvu/engines/v8/v8(+0x88c045) [0x56124b773045]
    /home/.jsvu/engines/v8/v8(+0xbb9049) [0x56124baa0049]
Received signal 4 ILL_ILLOPN 56124b1d86f2
/home/.jsvu/v8: linha 2: 12233 Instrução ilegal      (imagem do núcleo gravada) "/home/.jsvu/engines/v8/v8" --natives_blob="/home/.jsvu/engines/v8/natives_blob.bin" --snapshot_blob="/home/.jsvu/engines/v8/snapshot_blob.bin" "$@"

The same occurs with core dumps examples.

GraalJS and QuickJS will not install

Should these engines be included when running esvu --engines=all? Presently they do not install:

$ cat status.json
{
  "selectedEngines": [
    "ch",
    "engine262",
    "jsc",
    "jsshell",
    "v8",
    "xs"
  ],
  "installed": {
    "ch": {
      "version": "1_11_16",
      "binEntries": [
        "chakra"
      ]
    },
    "engine262": {
      "version": "0.0.1-587a1fa64b42201eccc48280a07b36bbb4f40b7e",
      "binEntries": [
        "engine262"
      ]
    },
    "jsc": {
      "version": "257719",
      "binEntries": [
        "javascriptcore",
        "jsc"
      ]
    },
    "jsshell": {
      "version": "74.0b9",
      "binEntries": [
        "sm",
        "spidermonkey"
      ]
    },
    "v8": {
      "version": "8.2.230",
      "binEntries": [
        "v8"
      ]
    },
    "xs": {
      "version": "10.0.0",
      "binEntries": [
        "xs"
      ]
    }
  }
}
rwaldron in ~/.esvu/engines
$ ls
.
├── [drwxr-xr-x rwaldron staff      96 Mar  2 14:25]  ch/
├── [drwxr-xr-x rwaldron staff      96 Mar  2 14:25]  engine262/
├── [drwxr-xr-x rwaldron staff      96 Mar  2 14:25]  jsc/
├── [drwxr-xr-x rwaldron staff     160 Mar  2 14:26]  jsshell/
├── [drwxr-xr-x rwaldron staff     160 Mar  2 14:26]  v8/
└── [drwxr-xr-x rwaldron staff      96 Mar  2 14:26]  xs/

Show the complete error output

Hi everyone,
any chance to add a feature that shows the complete stack output?
In some cases, I must to check if an issue violate an internal function or a test condition.

Example with eshost: $> eshost test.js

#### V8
RangeError: Offset is outside the bounds of the DataView

Example with V8 binary: $> ./v8 test.js

RangeError: Offset is outside the bounds of the DataView
    at DataView.getInt8 (<anonymous>)
    at test (.../test.js:6:13)
    at test.js:10:6

In second example we know that it was violated a pre-condition of DataView.getInt8 .
Maybe the arg "--stack" can show to the user the stack output of each engine.

Handling negative zero in `print`

➜  eshost -itsx 'function identity(x) {return x}; print(identity(-0))'
## Source
function identity(x) {return x}; print(identity(-0))

## Source
function identity(x) {return x}; print(identity(-0))

┌─────┬───┐
│ ch  │ 0 │
│ jsc │   │
│ sm  │   │
│ v8  │   │
│ xs  │   │
└─────┴───┘

In fact result should be -0 for all engines

> function ident(n) {return n}
< undefined
> ident(-0)
< -0

It seems that -0 coerces to String

jsvu-d8 reporting "Unexpected end of input" for basic test scripts

Verified that the latest eshost is installed (3.8.0 at time of writing) and the jsvu binary is up-to-date (latest):

> eshost -ie "42"
## Source
print(42)

#### jsvu-d8
SyntaxError: Unexpected end of input

The same script runs just fine directly under the jsvu d8 binary.

>where d8
C:\Users\doilij\.jsvu\d8.cmd
>d8 -e "print(42)"
42

Is there some d8 support change that is needed in eshost-cli or eshost or both?

Preparing 3.5.0

Since we've merged a number of features and created tests and increased test coverage, I'd like to update eshost-cli. Here's a draft of the release message:

v3.5.0

  • Add tests and enable Travis (@rwaldron #32)
  • --list learned to sort by name (@dilijev #34)
  • Learned --edit: allows modifying --args or --tags of a host (@dilijev #36)
  • Learned --unanimous, -u: exit(0) and print nothing if all hosts agree, otherwise exit(1). (@dilijev #35, @rwaldron #37)

Did I miss anything we should call out? Anything blocking?

/cc @bterlson @rwaldron

Appveyor CI

My rough plan:

  • reproduce (from travis) necessary build out
    • ... (add work steps here)
  • test on a "staging" (Bocoup) appveyor account
  • get it green

Cannot installed via pnpm

pnpm i -g eshost-cli
Packages: +414
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 509, reused 509, downloaded 0, added 0, done
node_modules/.pnpm/[email protected]/node_modules/publish-please: Running preinstall script, failed in 80ms
.../node_modules/publish-please preinstall$ node lib/pre-install.js
│ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
│ !! Starting from v2.0.0 publish-please can't be installed globally.          !!
│ !! Use local installation instead : 'npm install --save-dev publish-please', !!
│ !! Or use npx if you do not want to install publish-please as a dependency.  !!
│ !! (learn more: https://github.com/inikulin/publish-please#readme).          !!
│ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
└─ Failed in 80ms
 ERROR  Command failed with exit code 1.

auto-detect implementations on missing config file

We should be able to detect the locations of implementations through something similar to which js, which d8, etc. We should also probably run the --version to make sure it is compatible before adding it. This is slightly dangerous because we could be running things that are not ECMAScript implementations.

Errors on Mac due to carriage returns

When I npm install -g eshost and then eshost host I get env: node\r: No such file or directory - it seems the file is full of Windows newline characters.

My guess is that this is breaking it on non-Windows systems - when I remove the ^M chars, it seems to execute fine.

Non-table output displays stdout and stderr on same line

>eshost -is -h d8,sm,ch-dev E:\work\_curiosity_misc\out-err.js
## Source
print(42);
throw TypeError("blah");

#### d8, sm, ch-dev
42TypeError: blah

(Colors are correct, though.)

Note that table output shows them on separate lines:

eshost -its -h d8,sm,ch-dev E:\work\_curiosity_misc\out-err.js
## Source
print(42);
throw TypeError("blah");

┌────────┬─────────────────┐
│ d8     │ 42              │
│ sm     │ TypeError: blah │
│ ch-dev │                 │
└────────┴─────────────────┘

Unmatched hosts should generate human-readable error messages

The current behavior is a bit opaque.

$ eshost -h fake -se true
(node:9811) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'name' of undefined
    at /usr/lib/node_modules/eshost-cli/bin/eshost.js:385:17
    at Array.map (<anonymous>)
    at runInEachHost (/usr/lib/node_modules/eshost-cli/bin/eshost.js:383:11)
    at Object.<anonymous> (/usr/lib/node_modules/eshost-cli/bin/eshost.js:318:5)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
(node:9811) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9811) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

A question in the README document.

In the Install and Configure Hosts section of the README document. The "eshost --add" command cannot be used When installing eshost instead of eshost-cli with npm. So the correct installation command is "npm install -g eshost-cli"?

Hosts should be ordered consistently (alpha- or config-order)

It appears they are ordered in the order the results come back which makes the order inconsistent between runs, but it would be easier to compare between runs at a glance if the order was consistent.

Config-order is a nice, easy way to order the hosts. Perhaps easier is alphabetical order. Obviously respect output grouping first (--coalesce).

unable to delete host using `eshost host --delete`

$ eshost host --list
┌──────────────┬─────────┬───────────────────────────────────────────────┬──────┐
│ name         │ type    │ path                                          │ args │
├──────────────┼─────────┼───────────────────────────────────────────────┼──────┤
│ nashorn      │ nashorn │ /usr/java/jdk1.8.0_66/bin/jjs                 │      │
├──────────────┼─────────┼───────────────────────────────────────────────┼──────┤
│ jsc          │ jsc     │ /usr/bin/jsc                                  │      │
├──────────────┼─────────┼───────────────────────────────────────────────┼──────┤
│ node         │ node    │ /home/----/.nvm/versions/node/v5.4.1/bin/node │      │
├──────────────┼─────────┼───────────────────────────────────────────────┼──────┤
│ SpiderMonkey │ jsshell │ /usr/bin/js                                   │      │
└──────────────┴─────────┴───────────────────────────────────────────────┴──────┘
$ eshost host --delete SpiderMonkey
$ eshost host --list
┌──────────────┬─────────┬───────────────────────────────────────────────┬──────┐
│ name         │ type    │ path                                          │ args │
├──────────────┼─────────┼───────────────────────────────────────────────┼──────┤
│ nashorn      │ nashorn │ /usr/java/jdk1.8.0_66/bin/jjs                 │      │
├──────────────┼─────────┼───────────────────────────────────────────────┼──────┤
│ jsc          │ jsc     │ /usr/bin/jsc                                  │      │
├──────────────┼─────────┼───────────────────────────────────────────────┼──────┤
│ node         │ node    │ /home/----/.nvm/versions/node/v5.4.1/bin/node │      │
├──────────────┼─────────┼───────────────────────────────────────────────┼──────┤
│ SpiderMonkey │ jsshell │ /usr/bin/js                                   │      │
└──────────────┴─────────┴───────────────────────────────────────────────┴──────┘
$ 

Test hooks for setting config file

Sitting here with an empty eshost config, I feel like modifying the users config file is prone to failure. Can we add the appropriate test hooks to set the config path in Config.js instead?

Consistent order for host results

It's a little weird to run the same command twice and get output in a different order.

This means delaying results from fast engines to wait for slower ones, but does not increase total runtime.

Add -u|--unanimous flag: easily identify whether all engines agree on output

To help with automatic comparative testing between engines, add a -q|--quorum flag. Behavior will be as follows:

  • If all engines under test produce identical output (logic already exists to test this in the collate option), print no output and set exit code to 0.
  • If any engine disagrees, show output, and set exit code to 1
    • Alternatively: set the exit code to (1 + the index of the engine in the config file) to more easily identify which engine disagreed. Perhaps -1 if more than one engine disagrees or there is a greater than 2-way split on the outputs.

/cc @bterlson

cli-table: cell content truncation

Take a look:

Of course the data is intact:

...But I think this is not intuitive for eshost-cli's needs.

I'm going to investigate alternatives.

`--showSource --table` prints source input twice

Since this commit:

[ 5632a72 ] 2017-08-23 10:52 waldron... Restore default behavior; ensure correct conditions for --unanimous

Output e.g.:

>es --tags council -its -e "42"
## Source
print(42)

## Source
print(42)

┌──────────┬────┐
│ ch-1.7.1 │ 42 │
│ d8       │    │
│ node     │    │
│ node-ch  │    │
│ sm       │    │
└──────────┴────┘

Using default formatter, source is only shown once:

>es --tags council -is -e "42"
## Source
print(42)

#### ch-1.7.1, d8, node, node-ch, sm
42

Looks like part of the change was to restore the old behavior whereby start() prints the source and end() does not, but the change did not remove that block from end() in table.js, resulting in the double print.

Before resolving this I want to visit the design here.

As I envisioned, the design of --unanimous would be to print absolutely nothing (including source) and exit(0) if all engines agree on the input. Useful for scripting over a large number of test cases while easily being able to see the cases that disagreed and without having to route any output to /dev/null.

If --unanimous is specified, we should display source from end() and do so IFF there is NOT unanimous agreement (i.e. there is any output at all).

To preserve original behavior otherwise, print from start() IFF --unanimous is not specified.

/cc @rwaldron @bterlson

Unable to install GraalJS

(I'm not sure if this is an issue with eshost-cli or with GraalJS. If this is a Graal issue, I'm happy to move the discussion over there.)

I just tried to install GraalJS using eshost on a fresh Ubuntu 22.04 LTS box. I was able to install a few engines, but not GraalJS 21.3.3.1, the version available at the time. Here are the results:

$ npm install esvu -g
# snip successful install output
$ which esvu
/usr/local/bin/esvu
$ esvu --engines=all
esvu ❯ version 1.2.9
# snip
GraalJS ❯ Checking version...
GraalJS ❯ Installing version 21.3.3.1
GraalJS ❯ Downloading https://github.com/oracle/graaljs/releases/download/vm-21.3.3.1/graaljs-21.3.3.1-linux-amd64.tar.gz
GraalJS ❯ Extracting /tmp/esvu-ddf2ac3d55c5d5465e2a64c5ee2ee159
GraalJS ❯ Installing /tmp/esvu-ddf2ac3d55c5d5465e2a64c5ee2ee159-extracted
esvu ✖ Fatal error installing GraalJS [Error: ENOENT: no such file or directory, copyfile '/tmp/esvu-ddf2ac3d55c5d5465e2a64c5ee2ee159-extracted/graaljs-21.3.3.1-linux-amd64/lib/libjsvm.so' -> '/root/.esvu/engines/graaljs/graaljs-21.3.3.1-linux-amd64/lib/libjsvm.so'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'copyfile',
  path: '/tmp/esvu-ddf2ac3d55c5d5465e2a64c5ee2ee159-extracted/graaljs-21.3.3.1-linux-amd64/lib/libjsvm.so',
  dest: '/root/.esvu/engines/graaljs/graaljs-21.3.3.1-linux-amd64/lib/libjsvm.so'
}

Somehow we're trying to install a shared library that doesn't exist. I can confirm, though, that Graal's js binary is available, sitting uninstalled in that temprary directory:

$ ls /tmp/esvu-ddf2ac3d55c5d5465e2a64c5ee2ee159-extracted/graaljs-21.3.3.1-linux-amd64/
bin  LICENSE.txt  native-image.properties  README.md  release  THIRD_PARTY_LICENSE.txt
$ /tmp/esvu-ddf2ac3d55c5d5465e2a64c5ee2ee159-extracted/graaljs-21.3.3.1-linux-amd64/bin/js
> "2" + "2" - "2"
20

Any idea what might be going on?

Table formatting incorrect when display length of chars is different from byte length.

For chars with more than one byte, it looks like the table formatting is based on number of bytes rather than number of visible characters.

>eshost -its toLocaleDateString.js
## Source
let culture = ['zh-CN'];
print(Intl.DateTimeFormat.supportedLocalesOf(culture));
let str = new Date().toLocaleDateString(culture, { year: "numeric", month: "short", day: "numeric" });
print(str);
print(str.length);

┌──────────────┬──────────────────┐
│ d8           │ zh-CN            │
│ sm           │ 2017年5月17日       │
│              │ 10               │
├──────────────┼──────────────────┤
│ ch-1.4.3     │ zh-Hans-CN       │
│ ch-1.3.2     │ ?2017???5??17??  │
│ ch-1.2.3     │ 15               │
│ ch-master    │                  │
│ ch-2.0-pre   │                  │
│ ch-intl-gcl  │                  │
│ ch-dev       │                  │
├──────────────┼──────────────────┤
│ node         │ []               │
│ node-nightly │ May 17, 2017     │
│              │ 12               │
├──────────────┼──────────────────┤
│ node-ch      │ [ 'zh-Hans-CN' ] │
│              │ ‎2017‎年‎5月‎17‎日  │
│              │ 15               │
└──────────────┴──────────────────┘

For d8 and sm the line is too short because the Chinese characters have 2 bytes each.

For node-ch the line is too short because it displays bidi markers as 0-width (you can see from the question marks under ch).

Other test cases:

eshost -its -e "'2017\u{10401}'" # surrogate pair
eshost -its -e "'2017\u{5e74}'" # 年 CJK glyph for "year"
> eshost -its -e "'2017\u{10401}'"           
## Source                                
print('2017\u{10401}')                   
                                         
┌──────────────┬────────┐                
│ sm           │ 2017𐐁 │                
│ d8           │        │                
│ node-ch      │        │                
│ node         │        │                
│ node-nightly │        │                
├──────────────┼────────┤                
│ ch-1.4.3     │ 2017?? │                
│ ch-1.3.2     │        │                
│ ch-1.2.3     │        │                
│ ch-2.0-pre   │        │                
│ ch-intl-gcl  │        │                
│ ch-dev       │        │                
│ ch-master    │        │                
└──────────────┴────────┘                

> eshost -its -e "'2017\u{5e74}'"
## Source
print('2017\u{5e74}')

┌──────────────┬───────┐
│ d8           │ 2017年 │
│ sm           │       │
│ node-ch      │       │
│ node         │       │
│ node-nightly │       │
├──────────────┼───────┤
│ ch-1.4.3     │ 2017? │
│ ch-1.2.3     │       │
│ ch-1.3.2     │       │
│ ch-2.0-pre   │       │
│ ch-intl-gcl  │       │
│ ch-master    │       │
│ ch-dev       │       │
└──────────────┴───────┘

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

eshost --configure-jsvu

Using config "C:\Users\Jack\.eshost-config.json"
Configuring jsvu host with name "ChakraCore" (type "ch") at "C:\Users\Jack\.jsvu\chakra.cmd"
Host "ChakraCore" already exists
C:\Users\Jack\AppData\Roaming\npm\node_modules\eshost-cli\lib\host-manager.js:172
    ] = VU_HOST_DETAILS[vu][engine];
        ^

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at Object.exports.configureFromVersionUpdater (C:\Users\Jack\AppData\Roaming\npm\node_modules\eshost-cli\lib\host-manager.js:172:9)
    at Object.<anonymous> (C:\Users\Jack\AppData\Roaming\npm\node_modules\eshost-cli\bin\eshost.js:294:15)

With -s, default formatter groups node host output separately from other host types, even if output is the same

Default:

>eshost --tags council -is -x "print('a'); print(123);"
## Source
print('a'); print(123);

#### ch-1.7.1, d8, sm
a
123

#### node, node-ch
a
123

Table:

>eshost --tags council -its -x "print('a'); print(123);"
## Source
print('a'); print(123);

┌──────────┬─────┐
│ ch-1.7.1 │ a   │
│ d8       │ 123 │
│ node     │     │
│ node-ch  │     │
│ sm       │     │
└──────────┴─────┘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.