Project

General

Profile

Actions

Bug #16935

closed

Syntax error with `make check TESTS="-n /Foo#method/"`

Added by jaruga (Jun Aruga) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:98661]

Description

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
...

Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #16936: `make test-all TESTS="-n !/Foo#method/"` not skipping the test caseClosedActions
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Has duplicate Bug #16936: `make test-all TESTS="-n !/Foo#method/"` not skipping the test case added
Actions #2

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|0c00a4176ba353d59d8c991428574ef2c2676674.


Hash marks in Makefile need to be escaped [Bug #16935]

Updated by jaruga (Jun Aruga) almost 4 years ago

I escaped hash marks as \#. But I still got same error. Could you tell me the corerct command?

$ 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 unchanged
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

Updated by jaruga (Jun Aruga) almost 4 years ago

I succeeded the following command now on the latest master branch commit: 7a571103f231e8f9e7200aa40b9a56c3f34a2e80.

Does anyone fix it? Anyway, thanks!

$ make V=1 check TESTS="-v -n /\^TestBugReporter\#test_bug_reporter_add\$$/ -n /\^TestProcess\#test_status_quit\$$/"
...
ruby -v: ruby 2.8.0dev (2020-06-15T12:20:37Z master 7a571103f2) [x86_64-linux]
exec ./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems "./test/runner.rb" --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$/
/home/jaruga/git/ruby/ruby/test/rubygems/test_gem_package_task.rb: cannot load such file -- rake/packagetask
Run options: 
  --seed=22644
  "--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.43 s
[2/0] TestProcess#test_status_quit = 0.31 s
Finished tests in 9.179025s, 0.2179 tests/s, 1.6342 assertions/s.
2 tests, 15 assertions, 0 failures, 0 errors, 0 skips
...

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

The backslashes preceding ^ and # are not needed.
And $$ is necessary to pass a $ via make, but the preceding backslash can be omitted if you use single-qoutes instead of double-quotes.

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

It is a spec that $$ is replaced with a single $, but the ways may different for each implementations.
As GNU make allows single punctuations as macro names, $ = $ is set in the built-in definition to replace $$ with $. Similarly you can set /='$$/' to replace $/ with $/.
However other make, nmake for instance, may err such macro even if it is never used.

Updated by jaruga (Jun Aruga) almost 4 years ago

The backslashes preceding ^ and # are not needed.
And $$ is necessary to pass a $ via make, but the preceding backslash can be omitted if you use single-qoutes instead of double-quotes.

Thank you, I confirmed it worked with GNU Make.

$ make -v
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ make V=1 check TESTS='-v -n /^TestBugReporter#test_bug_reporter_add$$/ -n /^TestProcess#test_status_quit$$/'
...
[1/0] TestBugReporter#test_bug_reporter_add = 0.43 s
[2/0] TestProcess#test_status_quit = 0.33 s
Finished tests in 10.303173s, 0.1941 tests/s, 1.4559 assertions/s.
2 tests, 15 assertions, 0 failures, 0 errors, 0 skips

$ make V=1 check TESTS='-v -n /^TestBugReporter#test_bug_reporter_add$/ -n /^TestProcess#test_status_quit$/'
...
Finished tests in 8.021043s, 0.0000 tests/s, 0.0000 assertions/s.
0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0