Require - for stdin input to hermes cli

Summary: Update tests and hermes.cpp so that '-' input is required to take stdin input.

Reviewed By: avp

Differential Revision: D20978967

fbshipit-source-id: 99eaf7341ba437287e6aa36e013686df51dda310
This commit is contained in:
Neil Dhar 2020-04-15 10:38:40 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 753659feaf
Коммит f13566de28
7 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -target=HBC -gc-sanitize-handles=0 -O %s | %hermes -target=HBC -gc-sanitize-handles=0 -O | %FileCheck --match-full-lines %s
// RUN: %hermes -target=HBC -gc-sanitize-handles=0 -O %s | %hermes - -target=HBC -gc-sanitize-handles=0 -O | %FileCheck --match-full-lines %s
// This test is meant to make sure that Hermes generates long instructions for
// indexing into objects when it is necessary.

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -O0 -dump-source-location -dump-ir < %s | %FileCheck --match-full-lines %s
// RUN: %hermes - -O0 -dump-source-location -dump-ir < %s | %FileCheck --match-full-lines %s
function foo(a,b) {
if (a > b) {

Просмотреть файл

@ -27,7 +27,7 @@ SYM_TRACE="$TMPDIR/symbolicated_trace.txt"
( python3 "$SRCDIR/../stringize.py" SOURCEMAP < "$HBC_FILE.map" ;
python3 "$SRCDIR/../stringize.py" STACKTRACE < "$RAW_TRACE" ;
cat "$SRCDIR/../symbolicator.js.in"
) | "$HERMES" -gc-sanitize-handles=0 > "$SYM_TRACE"
) | "$HERMES" - -gc-sanitize-handles=0 > "$SYM_TRACE"
cat "$SYM_TRACE"
# CHECK: Error: ERROR_FOR_TESTING

Просмотреть файл

@ -58,7 +58,7 @@ run_1_test() {
( python3 $SRCDIR/stringize.py SOURCEMAP < "$HBC_FILE.map" ;
python3 $SRCDIR/stringize.py STACKTRACE < "$RAW_TRACE" ;
cat $SRCDIR/symbolicator.js.in
) | "$HERMES" -target=HBC -gc-sanitize-handles=0 > "$SYM_TRACE"
) | "$HERMES" - -target=HBC -gc-sanitize-handles=0 > "$SYM_TRACE"
# Ensure that the original and symbolicated stack trace are the same!
if ! diff "$ORIG_TRACE" "$SYM_TRACE" ; then

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
// RUN: echo "var obj ={0" ":0,"{1..65535} ":0};" | %hermes -target=HBC -O -gc-sanitize-handles=0
// RUN: echo "var obj ={0" ":0,"{1..65535} ":0};" | %hermes - -target=HBC -O -gc-sanitize-handles=0
// REQUIRES: !slow_debug
// The above echo generates JavaScript code like this:

Просмотреть файл

@ -5,6 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/
// RUN: echo "1" "**"{1..5000} | (! %hermes 2>&1 ) | %FileCheck --match-full-lines %s
// RUN: echo "1" "**"{1..5000} | (! %hermes - 2>&1 ) | %FileCheck --match-full-lines %s
// CHECK: <stdin>:1:{{.*}}: error: Too many nested expressions/statements/declarations

Просмотреть файл

@ -178,6 +178,12 @@ int main(int argc, char **argv) {
llvm::cl::AddExtraVersionPrinter(driver::printHermesCompilerVMVersion);
llvm::cl::ParseCommandLineOptions(argc, argv, "Hermes driver\n");
if (cl::InputFilenames.size() == 0) {
llvm::errs()
<< "Please provide a filename or '-' to take input from stdin\n";
return 0;
}
// Tell compiler to emit async break check if time-limit feature is enabled
// so that user can turn on this feature with single ExecutionTimeLimit
// option.