diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cdc68ef --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,41 @@ +--- +# Continuous Integration Workflow: Test case suite run + validation build check +name: CI + +# Controls when the action will run. +# Triggers the workflow on push or pull request events but only for the master branch +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + # Job: Unit test suite + unit-tests: + name: "Unit Tests" + runs-on: ubuntu-latest + steps: + # Install Multilib + - name: Install Multilib + run: | + sudo apt-get install --assume-yes --quiet gcc-multilib + + # Checks out repository under $GITHUB_WORKSPACE + - name: Checkout Latest Repo + uses: actions/checkout@v2 + with: + submodules: recursive + + # Install Ruby Testing Tools + - name: Setup Ruby Testing Tools + run: | + sudo gem install bundler + sudo gem install rspec + sudo gem install rubocop -v 0.57.2 + bundle install + + # Run Tests + - name: Run All Unit Tests + run: | + cd test && rake ci diff --git a/.gitignore b/.gitignore index 14f99d0..57fce96 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ test/system/build test/system/generated *.sublime-project +*.sublime-workspace Gemfile.lock .rake_t_cache .DS_Store diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d9e84ad..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -sudo: required -language: ruby c - -matrix: - include: - #- os: osx - # compiler: clang - # osx_image: xcode7.3 - - os: linux - dist: trusty - rvm: "2.4" - compiler: gcc - - os: linux - dist: xenial - rvm: "2.7" - compiler: clang - -before_install: - - sudo apt-get install --assume-yes --quiet gcc-multilib - -install: - - gem install bundler - - bundle install - - gem install rspec - - gem install rubocop -v 0.57.2 - -script: - - cd test && rake ci diff --git a/README.md b/README.md index 1120073..8fbfad0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ -CMock - Mock/stub generator for C -================================= +CMock ![CI](https://github.com/ThrowTheSwitch/CMock/workflows/CI/badge.svg) +===== +CMock is a mock and stub generator and runtime for unit testing C. It's been designed +to work smoothly with Unity Test, another of the embedded-software testing tools +developed by ThrowTheSwitch.org. CMock automagically parses your C headers and creates +useful and usable mock interfaces for unit testing. Give it a try! -[![CMock Build Status](https://api.travis-ci.org/ThrowTheSwitch/CMock.png?branch=master)](https://travis-ci.org/ThrowTheSwitch/CMock) +If you don't care to manage unit testing builds yourself, consider checking out Ceedling, +a test-centered build manager for unit testing C code. Getting Started ================ diff --git a/lib/cmock.rb b/lib/cmock.rb index c224fa1..72f8641 100644 --- a/lib/cmock.rb +++ b/lib/cmock.rb @@ -87,16 +87,15 @@ if $0 == __FILE__ options = {} filelist = [] ARGV.each do |arg| - if (arg =~ /^-o\"?([a-zA-Z0-9@._\\\/:\s]+)\"?/) + if arg =~ /^-o\"?([a-zA-Z0-9@._\\\/:\s]+)\"?/ options.merge! CMockConfig.load_config_file_from_yaml(arg.gsub(/^-o/, '')) - elsif (arg == '--skeleton') + elsif arg == '--skeleton' options[:skeleton] = true - elsif (arg =~ /^--strippables=\"?(.*)\"?/) + elsif arg =~ /^--strippables=\"?(.*)\"?/ # --strippables are dealt with separately since the user is allowed to # enter any valid regular expression as argument options = option_maker(options, 'strippables', Regexp.last_match(1)) - elsif (arg =~ /^--([a-zA-Z0-9._\\\/:\s]+)= - \"?([a-zA-Z0-9._\-\\\/:\s\;]*)\"?/x) + elsif arg =~ /^--([a-zA-Z0-9._\\\/:\s]+)=\"?([a-zA-Z0-9._\-\\\/:\s\;]*)\"?/x options = option_maker(options, Regexp.last_match(1), Regexp.last_match(2)) else diff --git a/test/unit/cmock_header_parser_test.rb b/test/unit/cmock_header_parser_test.rb index 92c7736..cb535ef 100644 --- a/test/unit/cmock_header_parser_test.rb +++ b/test/unit/cmock_header_parser_test.rb @@ -2245,7 +2245,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do "#include \"cmock.h\"\n" + "#include \"YetAnotherHeader.h\"\n" + "\n" + - "/* Ignore the following warnings since we are copying code */\n" + + "\n" + #The comments are now removed "#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n" + "#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n" + "#pragma GCC diagnostic push\n" +