Skip to content
Browse files

Allow test modules to be specifed in the rakefile.defaults file

Update Readme
  • Loading branch information...
1 parent 8329667 commit 80bbeba99eef5227828496fdd25e7aafce62d909 @wolfmanjm wolfmanjm committed Sep 12, 2015
Showing with 27 additions and 2 deletions.
  1. +1 −1 Rakefile
  2. +8 −0 rakefile.defaults.example
  3. +18 −1 src/testframework/Readme.md
View
2 Rakefile
@@ -116,7 +116,7 @@ end
if TESTING
# add modules to be tested here
- TESTMODULES= %w(tools/temperatureswitch)
+ TESTMODULES= %w(tools/temperatureswitch) unless defined? EXCLUDE_MODULES
puts "Modules under test: #{TESTMODULES}"
excludes << %w(Kernel.cpp main.cpp) # we replace these with mock versions in testframework
testmodules= FileList['src/testframework/*.{c,cpp}', 'src/testframework/easyunit/*.{c,cpp}', 'src/modules/communication/SerialConsole.cpp', 'src/modules/communication/utils/Gcode.cpp'].include(TESTMODULES.collect { |e| "src/modules/#{e}/**/*.{c,cpp}"}).include(TESTMODULES.collect { |e| "src/testframework/unittests/#{e}/*.{c,cpp}"})
View
8 rakefile.defaults.example
@@ -0,0 +1,8 @@
+# if regular build the modules to exclude from the build
+NONETWORK = true
+EXCLUDE_MODULES = %w(tools/touchprobe tools/laser tools/temperaturecontrol tools/extruder)
+
+# if test framework build the modules to include in the test...
+# here we enable unit tests for tools/temperatureswitch module and any unit tests in /src/testframework/unittests/tools/temperatureswitch/
+# and any unittests in the src/testframework/unittests/libs folder
+TESTMODULES= %w(tools/temperatureswitch libs)
View
19 src/testframework/Readme.md
@@ -7,7 +7,7 @@ This is a frame work for writing unit tests for modules or libs.
It compiles only src/libs/... and a few select needed modules by default.
It runs on the target and the output is written to the serial UART, it runs well with MRI so you can also debug with GDB.
-You can edit the Rakefile to specify which module you are going to test the example has tools/temperaturecontrol selected.
+You can edit a file to specify which module you are going to test by default the example has tools/temperaturecontrol selected.
The unit tests go in a directory named src/testframework/unittests/*XXXX*/*YYYY* where *XXXX* is the module subdirectory (tools,utils) and *YYYY* is the modulename
@@ -35,6 +35,23 @@ You compile a unit test and framework using [rake](http://rake.rubyforge.org/)..
The unit test will run, the results are printed to the serial uart port, and then it is left in DFU mode so `rake upload` can be run again for the next test.
+You select which tests and modules you want to compile by creating a file called rakefile.defaults in the same directory as the Rakefile is found.
+
+```shell
+TESTMODULES= %w(tools/temperatureswitch libs)
+```
+
+Here we enable unit tests for the tools/temperatureswitch module and any unit tests in src/testframework/unittests/tools/temperatureswitch/.
+Also any unittests in the src/testframework/unittests/libs folder will be included
+
+In this case all files in src/libs/... are compiled anyway so we only need to enable unit tests in the src/testframework/unittests/libs folder.
+
+the tools/temperatureswitch both compiles all files in the src/modules/tools/temperatureswitch/... directory and enables the
+unit tests in src/testframework/unittests/tools/temperatureswitch/...
+
+by default no other files in the src/modules/... directory tree are compiled unless specified above.
+
+

0 comments on commit 80bbeba

Please sign in to comment.
Something went wrong with that request. Please try again.