Issue #16935 has been reported by jaruga (Jun Aruga).

----------------------------------------
Bug #16935: Syntax error with `make check TESTS="-n /Foo#method/"`
https://bugs.ruby-lang.org/issues/16935

* Author: jaruga (Jun Aruga)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
On the current latest master `cf1adf985ab78507250db0e217a0fdd779e2c6e6`.

```
$ autoconf

$ ./configure --prefix=$(pwd)/dest

$ make
```

The following `make test-all` works.

```
$ make test-all TESTS="-v -n /\^TestBugReporter#test_bug_reporter_add\$$/ -n /\^TestProcess#test_status_quit\$$/"
config.status: creating ruby-runner.h
making mjit_build_dir.so
generating x86_64-linux-fake.rb
x86_64-linux-fake.rb updated
/home/jaruga/git/ruby/ruby/test/rubygems/test_gem_package_task.rb: cannot load such file -- rake/packagetask
Run options: 
  --seed=96488
  "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems"
  --excludes-dir=./test/excludes
  --name=!/memory_leak/
  -v
  -n
  "/^TestBugReporter#test_bug_reporter_add$/"
  -n
  "/^TestProcess#test_status_quit$/"

# Running tests:

[1/0] TestBugReporter#test_bug_reporter_add = 0.41 s
[2/0] TestProcess#test_status_quit = 0.35 s
Finished tests in 9.392046s, 0.2129 tests/s, 1.5971 assertions/s.
2 tests, 15 assertions, 0 failures, 0 errors, 0 skips

ruby -v: ruby 2.8.0dev (2020-06-05T12:54:39Z master cf1adf985a) [x86_64-linux]
```

But the following `make check` does not work with shell syntax error.
Is it a bug?

```
$ make check TESTS="-v -n /\^TestBugReporter#test_bug_reporter_add\$$/ -n /\^TestProcess#test_status_quit\$$/"
...
generating makefiles ext/configure-ext.mk
ext/configure-ext.mk updated
make[1]: Entering directory '/home/jaruga/git/ruby/ruby'
/bin/sh: -c: line 1: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 3: syntax error: unexpected end of file
make[1]: *** [ext/configure-ext.mk:19: ext/-test-/exts.mk] Error 1
make[1]: Leaving directory '/home/jaruga/git/ruby/ruby'
make: *** [uncommon.mk:277: exts.mk] Error 2
```

It seems the following `TESTS=-v\ -n\ /\\^TestBugReporter` is something wrong splitting `#test_bug_reporter_add`.


```
$ make V=1 check TESTS="-v -n /\^TestBugReporter#test_bug_reporter_add\$$/ -n /\^TestProcess#test_status_quit\$$/"
...
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -o ext/configure-ext.mk -c \
    ./template/configure-ext.mk.tmpl --srcdir="." \
    --miniruby="./miniruby -I./lib -I. -I.ext/common " --script-args='--dest-dir="" --extout=".ext" --mflags="" --make-flags=" -- TESTS=-v\ -n\ /\\^TestBugReporter#test_bug_reporter_add$$$$/\ -n\ /\\^TestProcess#test_status_quit$$$$/ V=1"'
ext/configure-ext.mk updated
make -f ext/configure-ext.mk  V=1 EXTSTATIC= \
	gnumake=yes MINIRUBY="./miniruby -I./lib -I. -I.ext/common " \
	EXTLDFLAGS="" srcdir="."
make[1]: Entering directory '/home/jaruga/git/ruby/ruby'
./miniruby -I./lib -I. -I.ext/common  ./ext/extmk.rb --make='make' \
	--command-output=ext/-test-/exts.mk --dest-dir="" --extout=".ext" --mflags="" --make-flags=" -- TESTS=-v\ -n\ /\\^TestBugReporter --gnumake=yes --extflags="" --make-flags="MINIRUBY='./miniruby -I./lib -I. -I.ext/common '" --extstatic  \
	-- configure ext/-test-
/bin/sh: -c: line 1: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 3: syntax error: unexpected end of file
make[1]: *** [ext/configure-ext.mk:19: ext/-test-/exts.mk] Error 1
make[1]: Leaving directory '/home/jaruga/git/ruby/ruby'
make: *** [uncommon.mk:277: exts.mk] Error 2
```

The following `make check` works if `#method` does not exist.

```
$ make check TESTS="-v -n /test_bug_reporter_add/ -n /test_status_quit/"
...
[1/2] TestBugReporter#test_bug_reporter_add = 0.48 s
[2/2] TestProcess#test_status_quit = 0.31 s
Finished tests in 8.924195s, 0.2241 tests/s, 1.6808 assertions/s.
2 tests, 15 assertions, 0 failures, 0 errors, 0 skips
...
```




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>