ThrowTheSwitch / CMock

CMock - Mock/stub generator for C
http://throwtheswitch.org
MIT License
652 stars 269 forks source link

Is CMock meant to work on Windows at all? #435

Open ACleverDisguise opened 1 year ago

ACleverDisguise commented 1 year ago
PS E:\Junk\UnityDemo1\cmock\test> rake --trace
E:/Junk/UnityDemo1/cmock/vendor/unity/auto/colour_prompt.rb:9: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
rake aborted!
Psych::BadAlias: Unknown alias: systest_generated_path
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:430:in `visit_Psych_Nodes_Alias'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `block in register_empty'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `each'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `register_empty'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:146:in `visit_Psych_Nodes_Sequence'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych.rb:334:in `safe_load'
D:/msys64/mingw64/lib/ruby/3.1.0/psych.rb:369:in `load'
E:/Junk/UnityDemo1/cmock/test/rakefile_helper.rb:24:in `load_configuration'
E:/Junk/UnityDemo1/cmock/test/rakefile_helper.rb:34:in `configure_toolchain'
E:/Junk/UnityDemo1/cmock/test/rakefile:32:in `<top (required)>'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load_rakefile'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:710:in `raw_load_rakefile'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:104:in `block in load_rakefile'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:103:in `load_rakefile'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:82:in `block in run'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
D:/msys64/mingw64/bin/rake:33:in `load'
D:/msys64/mingw64/bin/rake:33:in `<main>'

This is after I ran bundle install, after it complained about not having a gem anyway, after it recommended gem install Win32API (which isn't a thing), after I figured out that gem install win32api was the right incantation, and after I figured out that I had to manually put Unity into the vendor/unity directory.

I'm getting this impression that CMock has never actually been tested on a clean Windows system to provide instructions on how to get it working. And at this point, since I have no idea what a "Psych" is (and I really do not want to start getting into Ruby development to test my embedded code!), I'm kind of stuck at this point. Any guidance? Documentation and/or code fix, maybe?

Letme commented 1 year ago

I am not sure what you are actually trying to achieve and where there is any windows dependency...

Cmock is bunch of ruby scripts which generates C code, so I do not see a dependency. Did you use git submodule update --init --recursive to initialize all subrepos of cmock?

And yes, by default it generates unity compatible macros, so you will need translation header for other frameworks to work.

mvandervoord commented 1 year ago

@ACleverDisguise -- it appears the current instructions are somewhat misleading. Running bundle install will install all the dependencies needed to help with CMock development and use all optional CMock scripts. One of of those optional scripts is the color formatter, which is the one you've run into.

I apologize for both the error and the poor documentation. I'd appreciate it if you'd leave this bug open for now, so we can rectify these things. The next release will include these fixes.

Now that you have CMock downloaded, you should be able to run it to mock headers, etc., even though the color script isn't enabled. There's no need for you to run the complete self-test suite in order to USE CMock.

ACleverDisguise commented 1 year ago

Well, I tried running the full self-test suite as a check of the condition of the software, to be honest. Partially to see if the software is suited to purpose (and thus far ... ah ... I'm not happy, to put it mildly -- CException and Unity worked well, but this has been an exercise in frustration thus far) and partially to make sure that I've got my environment actually set up right (because a lot of F/OSS that claims to be cross-platform was never even waved in the general direction of a non-Linux environment and thus lacks the information needed to make it actually work on such).

I appreciate the quick response to the issue however. It settles my nerves quite a bit and gives me a bit more patience while evaluation is going on.

ACleverDisguise commented 1 year ago

There is one suggestion I'm going to make for CMock: the ZIP file should contain Unity in the vendor tree. It was a bit of a rude surprise that I had to go dig up my copy of Unity to stick in there.

mvandervoord commented 1 year ago

The zip file is automatically generated by github and doesn't contain subprojects. We've been talking about alternative release methods, including as a ruby gem or other packages.

ACleverDisguise commented 1 year ago

I could think of a couple for Windows:

Letme commented 1 year ago

There is also Chocolatey, but none of that is cross/platform. While gem is.

ACleverDisguise commented 1 year ago

And yet I can't get the fiddle gem to install on Windows for the life of me. Almost as if:

a lot of F/OSS that claims to be cross-platform was never even waved in the general direction of a non-Linux environment

mvandervoord commented 1 year ago

As one of the original developers of CMock, who used nothing but Windows at the time, I can assure you that's not the case. As I stated above, the issue is that the Ruby ecosystem is shifting. They're unafraid of making breaking changes, which is inconvenient for those of us using them. We're forced to constantly play catchup.

Out of curiosity, why are you installing fiddle? Are you adding something that links directly to a windows dll from Ruby?

ACleverDisguise commented 1 year ago

Oh, I recognize that this is Ruby causing the problem here, not you. I was very unimpressed, for example, to find out that Ruby 3.1→3.2 caused breaking API changes. That gems fail mysteriously out of nowhere isn't on you in the slightest. Sorry if I gave that impression.

No, I'm pretty much aiming that "F/OSS that claims to be cross-platform" at the overall culture of F/OSS where "cross-platform" is more a statement of assumption (not even intent!) than a statement of verified proof. You're just caught in the crossfire of this mess in the Ruby subset of the F/OSS ecosystem.

Originally I was installing fiddle (since before I even opened this bug report) because it looked like it was the culprit in the mess that was brewing up around CMock. I gave up on that after you told me that's just an unnecessary piece that shouldn't have been messaging. I'm just holding fiddle up as a contrary example to, and I quote:

but none of that is cross/platform. While gem is.

Because it's trivial to find things in gem that aren't cross-platform (often even when explicitly labelled as being such!).

DanieleNardi commented 4 months ago
PS E:\Junk\UnityDemo1\cmock\test> rake --trace
E:/Junk/UnityDemo1/cmock/vendor/unity/auto/colour_prompt.rb:9: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
rake aborted!
Psych::BadAlias: Unknown alias: systest_generated_path
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:430:in `visit_Psych_Nodes_Alias'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `block in register_empty'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `each'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `register_empty'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:146:in `visit_Psych_Nodes_Sequence'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
D:/msys64/mingw64/lib/ruby/3.1.0/psych.rb:334:in `safe_load'
D:/msys64/mingw64/lib/ruby/3.1.0/psych.rb:369:in `load'
E:/Junk/UnityDemo1/cmock/test/rakefile_helper.rb:24:in `load_configuration'
E:/Junk/UnityDemo1/cmock/test/rakefile_helper.rb:34:in `configure_toolchain'
E:/Junk/UnityDemo1/cmock/test/rakefile:32:in `<top (required)>'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load_rakefile'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:710:in `raw_load_rakefile'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:104:in `block in load_rakefile'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:103:in `load_rakefile'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:82:in `block in run'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
D:/scoop/persist/ruby/gems/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
D:/msys64/mingw64/bin/rake:33:in `load'
D:/msys64/mingw64/bin/rake:33:in `<main>'

This is after I ran bundle install, after it complained about not having a gem anyway, after it recommended gem install Win32API (which isn't a thing), after I figured out that gem install win32api was the right incantation, and after I figured out that I had to manually put Unity into the vendor/unity directory.

I'm getting this impression that CMock has never actually been tested on a clean Windows system to provide instructions on how to get it working. And at this point, since I have no idea what a "Psych" is (and I really do not want to start getting into Ruby development to test my embedded code!), I'm kind of stuck at this point. Any guidance? Documentation and/or code fix, maybe?

I had the same issue installing Ceedling, solved installing a previous version of Ruby, 3.0.6, from RubyInstaller.