Skip to content

Instantly share code, notes, and snippets.

@jccarbonfive
Created October 15, 2012 02:12
Show Gist options
  • Save jccarbonfive/3890491 to your computer and use it in GitHub Desktop.
Save jccarbonfive/3890491 to your computer and use it in GitHub Desktop.
$ gem install ceedling
$ ceedling new sample-project
...
Project 'sample-project' created!
- Tool documentation is located in vendor/ceedling/docs
- Execute 'rake -T' to view available test & build tasks
$ cd sample-project
$ tree -L 1
.
├── build
├── project.yml
├── rakefile.rb
├── src
├── test
└── vendor
4 directories, 2 files
$ ceedling examples
Available sample projects:
blinky
temp_sensor
$ ceedling example blinky
$ cd blinky
$ tree -L 2
.
├── build
├── project.yml
├── rakefile.rb
├── src
│   ├── BlinkTask.c
│   ├── BlinkTask.h
│   ├── Configure.c
│   ├── Configure.h
│   ├── main.c
│   └── main.h
├── test
│   ├── support
│   ├── test_BlinkTask.c
│   ├── test_Configure.c
│   └── test_main.c
└── vendor
└── ceedling
6 directories, 11 files
$ rake -T
rake clean # Delete all build artifacts and temporary products.
rake clobber # Delete all generated files (and build artifacts).
rake environment # List all configured environment variables.
rake files:header # List all collected header files.
rake files:source # List all collected source files.
rake files:test # List all collected test files.
rake logging # Enable logging
rake module:create[module_path] # Generate module (source, header and test files)
rake module:destroy[module_path] # Destroy module (source, header and test files)
rake paths:source # List all collected source paths.
rake paths:support # List all collected support paths.
rake paths:test # List all collected test paths.
rake summary # Execute plugin result summaries (no build triggering).
rake test:* # Run single test ([*] real test or source file name, no path).
rake test:all # Run all unit tests.
rake test:delta # Run tests for changed files.
rake test:path[dir] # Run tests whose test path contains [dir] or [dir] substring.
rake test:pattern[regex] # Run tests by matching regular expression pattern.
rake verbosity[level] # Set verbose output (silent:[0] - obnoxious:[4]).
rake version # Display build environment version info.
$ rake module:create[point]
Generating 'point'...
mkdir -p ./test/.
mkdir -p ./src/.
File ./test/./test_point.c created
File ./src/./point.c created
File ./src/./point.h created
$ rake test:all
Test 'test_point.c'
-------------------
Running test_point.out...
-------------------------
IGNORED UNIT TEST SUMMARY
-------------------------
[test_point.c]
Test: test_module_generator_needs_to_be_implemented
At line (14): "Implement me!"
-------------------------
OVERALL UNIT TEST SUMMARY
-------------------------
TESTED: 1
PASSED: 0
FAILED: 0
IGNORED: 1
#include "unity.h"
#include "point.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_MakePoint_Returns_A_New_Point(void)
{
struct point pt = MakePoint(3, 4);
TEST_ASSERT_EQUAL_INT(3, pt.x);
TEST_ASSERT_EQUAL_INT(4, pt.y);
}
$ rake test:all
Test 'test_point.c'
-------------------
Generating runner for test_point.c...
Compiling test_point_runner.c...
Compiling test_point.c...
test/test_point.c: In function ‘test_MakePoint_Returns_A_New_Point’:
test/test_point.c:14: error: variable ‘pt’ has initializer but
incomplete type
test/test_point.c:14: error: storage size of ‘pt’ isn’t known
ERROR: Shell command failed.
> Shell executed command:
'gcc -I"test" -I"test/support" -I"src"
-I"/Users/jared/Projects/sample-project/vendor/ceedling/vendor/unity/src"
-I"/Users/jared/Projects/sample-project/vendor/ceedling/vendor/cmock/src"
-I"build/test/mocks" -DTEST -DGNU_COMPILER -c "test/test_point.c" -o
"build/test/out/test_point.o"'
> And exited with status: [1].
...
#ifndef point_H
#define point_H
struct point {
int x;
int y;
};
struct point MakePoint(int, int);
#endif // point_H
$ rake test:all
Test 'test_point.c'
-------------------
Compiling test_point.c...
Compiling point.c...
Linking test_point.out...
Undefined symbols for architecture x86_64:
"_MakePoint", referenced from:
_test_MakePoint_Returns_A_New_Point in test_point.o
(maybe you meant: _test_MakePoint_Returns_A_New_Point)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
ERROR: Shell command failed.
> Shell executed command:
'gcc "build/test/out/test_point_runner.o" "build/test/out/test_point.o"
"build/test/out/point.o" "build/test/out/unity.o"
"build/test/out/cmock.o" -o "build/test/out/test_point.out"'
> And exited with status: [1].
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment