ThrowTheSwitch / Ceedling

Ruby-based unit testing and build system for C projects
http://throwtheswitch.org
Other
597 stars 246 forks source link

uninitialized constant ToolExecutor::RUBY_EVAL_REPLACEMENT_PATTERN #922

Closed christ-re closed 2 months ago

christ-re commented 2 months ago

Hi,

i have installed ceedling 1.0.0-3d9cd04 and ruby ruby 3.3.4 on Windows. I tried to run my tests with clang compiler v 18.1.8, but there is a problem.

When i run this config:


:tools:
  :test_compiler:
    :executable: clang
  :test_linker:
    :executable: clang

this works fine, but i wanted to add some custom flags, so i changed it to this:

:tools:
  :test_compiler:
    :executable: clang
    :arguments:
      - '"${1}"'
      - '-o "${2}"'  
      - '-c'
      - '-I"$"': COLLECTION_PATHS_VENDOR
  :test_linker:
    :executable: clang
    :arguments:
      - '"${1}"'
      - '-o "${2}"'

and get this error:

Building Objects
----------------
Compiling TestDemo.c...
EXCEPTION: NameError ==> uninitialized constant ToolExecutor::RUBY_EVAL_REPLACEMENT_PATTERN
Ceedling could not complete operations because of errors

Does anybody know whats the issue? When i downgrade to ceedling 0.31.1 and ruby 3.1.6 then it works, but i would like to use newer versions if possible.

Thank you all

christ-re commented 2 months ago

Update i think i managed to figure out what the problem is. It seems that from the 1.0.0-fcf7c82 to the 1.0.0-3d9cd04 the constant RUBY_EVAL_REPLACEMENT_PATTERN was removed from the lib/ceedling/constant.rb file.

constants.rb from 1.0.0-fcf7c82:

# Match presence of any glob pattern characters
GLOB_PATTERN = /[\*\?\{\}\[\]]/
RUBY_STRING_REPLACEMENT_PATTERN = /#\{.+\}/
RUBY_EVAL_REPLACEMENT_PATTERN   = /^\{(.+)\}$/
TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN = /(\$\{(\d+)\})/
TEST_STDOUT_STATISTICS_PATTERN  = /\n-+\s*(\d+)\s+Tests\s+(\d+)\s+Failures\s+(\d+)\s+Ignored\s+(OK|FAIL)\s*/i

constants.rb from 1.0.0-3d9cd04:

# Match presence of any glob pattern characters
GLOB_PATTERN = /[\*\?\{\}\[\]]/
RUBY_STRING_REPLACEMENT_PATTERN = /#\{.+\}/
TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN = /(\$\{(\d+)\})/
TEST_STDOUT_STATISTICS_PATTERN  = /\n-+\s*(\d+)\s+Tests\s+(\d+)\s+Failures\s+(\d+)\s+Ignored\s+(OK|FAIL)\s*/i

When i add it manually i don't get the error. So i think it is a bug from the newest version right?

mkarlesky commented 2 months ago

@christ-re So sorry about that. Thanks for the report. A little-used and problematic feature was recently remover in favor of another being expanded for use in tool definitions. It seems we lack a test case for a code path for a more advanced form of tool argument definitions. A new prerelease is coming very soon. We'll get this fixed in that prerelease as well.

mkarlesky commented 2 months ago

This is fixed in 1.0.0-d880297.