-
Notifications
You must be signed in to change notification settings - Fork 34
Support custom defines
for unittest definitions
#104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The spirit of Along those same lines, I'd prefer not to change the compiler arguments at all -- my feeling is that they should mimic the Arduino IDE's compile options to the extent possible ( I'm confused at what you're after for the platform-specific stuff as well like Your points about |
I've pushed some updates to REFERENCE.md, I'm not sure if they address any of what you're asking for here. |
Both USE_FAKE_KEYBOARD and SKIP_LCD_TESTS were made up examples while writing that comment so they do not have any deep meaning. My current need is for differentiating between target compilation and unit test. I am using a FSM library that contains some So putting TINYFSM_NOSTDLIB in defines for compile and not in unittest would be one scenario (although in my case I want tinyfsm' disable logic to be reversed, instead of enabled unless disabled I want it to be disabled unless enabled. This because I want to be able to compile in android studio or with vscode as well where the tests needs to be disabled out of the box. Therefore I have modified the header file to include #ifndef UNIT_TEST
#define TINYFSM_NOSTDLIB
#endif and enable UNIT_TEST only when running aduino_ci's unittest). With regards to compiler options, |
I do use arg_sets = []
arg_sets << ["-std=c++0x", "-o", executable.to_s, "-DARDUINO=100"]
if libasan?(gcc_binary)
arg_sets << [ # Stuff to help with dynamic memory mishandling
"-g", "-O1",
"-fno-omit-frame-pointer",
"-fno-optimize-sibling-calls",
"-fsanitize=address"
]
end
arg_sets << test_args(aux_libraries, ci_gcc_config)
arg_sets << cpp_files_libraries(aux_libraries).map(&:to_s)
arg_sets << [test_file.to_s]
args = arg_sets.flatten(1) I'm unfamiliar with As for the While I'm very much in favor of the idea of creating a system where those dual-use libraries are possible (and easy), that's a very ambitious goal and this project isn't mature enough to just take that in stride. If and when this project gets to the point where we cover the Arduino hardware functions really well and achieve some sort of compiler-parity (i.e. when we run out of stuff like #102 and #72), then I will absolutely go after something like this. But for now, I think that's too risky of a thing to chase after. Again, please reopen if I'm missing something important there. |
In the platform definitions it is possible to inject custom preprocessor defines to be used, e.g.
What I am missing is for this to be possible to do for unittest definitions (
UNITTEST_SCHEMA
) in.arduino-ci.yaml
as well, e.g.In addition to
defines
acompiler_argument
option would be applicable to be able to give arguments like-g -O0 --coverage --std=c++98 ...
.Currently I am just adding
ret += [ "-DUNIT_TEST", "-g", "--coverage" ]
intest_args
, but it would be great to not have to modify arduino_ci.This would be applicable for
compile
as well.The text was updated successfully, but these errors were encountered: