cJSON
[Ported from github.com/DaveGamble/cJSON] Fix: heap-use-after-free in merge_patch when patch is subtree of target (#1065)
Brought by drakestapleton
cJSON / tests / unity / test / rakefile
| 1 | # ========================================== |
| 2 | # Unity Project - A Test Framework for C |
| 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams |
| 4 | # [Released under MIT License. Please refer to license.txt for details] |
| 5 | # ========================================== |
| 6 | |
| 7 | UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/' |
| 8 | $verbose = false |
| 9 | |
| 10 | require 'rake' |
| 11 | require 'rake/clean' |
| 12 | require UNITY_ROOT + 'rakefile_helper' |
| 13 | require 'rspec/core/rake_task' |
| 14 | |
| 15 | TEMP_DIRS = [ |
| 16 | File.join(UNITY_ROOT, 'build'), |
| 17 | File.join(UNITY_ROOT, 'sandbox') |
| 18 | ] |
| 19 | |
| 20 | TEMP_DIRS.each do |dir| |
| 21 | directory(dir) |
| 22 | CLOBBER.include(dir) |
| 23 | end |
| 24 | |
| 25 | task :prepare_for_tests => TEMP_DIRS |
| 26 | |
| 27 | include RakefileHelpers |
| 28 | |
| 29 | # Load proper GCC as default configuration |
| 30 | DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml' |
| 31 | configure_toolchain(DEFAULT_CONFIG_FILE) |
| 32 | |
| 33 | desc "Test unity with its own unit tests" |
| 34 | task :unit => [:prepare_for_tests] do |
| 35 | run_tests unit_test_files |
| 36 | end |
| 37 | |
| 38 | desc "Test unity's helper scripts" |
| 39 | task :scripts => [:prepare_for_tests] do |
| 40 | Dir['tests/test_*.rb'].each do |scriptfile| |
| 41 | require "./"+scriptfile |
| 42 | end |
| 43 | end |
| 44 | |
| 45 | desc "Run all rspecs" |
| 46 | RSpec::Core::RakeTask.new(:spec) do |t| |
| 47 | t.pattern = 'spec/**/*_spec.rb' |
| 48 | end |
| 49 | |
| 50 | desc "Generate test summary" |
| 51 | task :summary do |
| 52 | report_summary |
| 53 | end |
| 54 | |
| 55 | desc "Build and test Unity" |
| 56 | task :all => [:clean, :prepare_for_tests, :scripts, :unit, :style, :summary] |
| 57 | task :default => [:clobber, :all] |
| 58 | task :ci => [:no_color, :default] |
| 59 | task :cruise => [:no_color, :default] |
| 60 | |
| 61 | desc "Load configuration" |
| 62 | task :config, :config_file do |t, args| |
| 63 | configure_toolchain(args[:config_file]) |
| 64 | end |
| 65 | |
| 66 | task :no_color do |
| 67 | $colour_output = false |
| 68 | end |
| 69 | |
| 70 | task :verbose do |
| 71 | $verbose = true |
| 72 | end |
| 73 | |
| 74 | namespace :style do |
| 75 | desc "Check style" |
| 76 | task :check do |
| 77 | report "\nVERIFYING RUBY STYLE" |
| 78 | report execute("rubocop ../auto ../examples ../extras --config .rubocop.yml", true) |
| 79 | report "Styling Ruby:PASS" |
| 80 | end |
| 81 | |
| 82 | namespace :check do |
| 83 | Dir['../**/*.rb'].each do |f| |
| 84 | filename = File.basename(f, '.rb') |
| 85 | desc "Check Style of #{filename}" |
| 86 | task filename.to_sym => ['style:clean'] do |
| 87 | report execute("rubocop #{f} --color --config .rubocop.yml", true) |
| 88 | report "Style Checked for #{f}" |
| 89 | end |
| 90 | end |
| 91 | end |
| 92 | |
| 93 | desc "Fix Style of all C Code" |
| 94 | task :c do |
| 95 | run_astyle("../src/*.* ../extras/fixture/src/*.*") |
| 96 | end |
| 97 | |
| 98 | namespace :c do |
| 99 | Dir['../{src,extras/**}/*.{c,h}'].each do |f| |
| 100 | filename = File.basename(f)[0..-3] |
| 101 | desc "Check Style of #{filename}" |
| 102 | task filename.to_sym do |
| 103 | run_astyle f |
| 104 | end |
| 105 | end |
| 106 | end |
| 107 | |
| 108 | desc "Attempt to Autocorrect style" |
| 109 | task :auto => ['style:clean'] do |
| 110 | execute("rubocop ../auto ../examples ../extras --auto-correct --config .rubocop.yml") |
| 111 | report "Autocorrected What We Could." |
| 112 | end |
| 113 | |
| 114 | desc "Update style todo list" |
| 115 | task :todo => ['style:clean'] do |
| 116 | execute("rubocop ../auto ../examples ../extras --auto-gen-config --config .rubocop.yml") |
| 117 | report "Updated Style TODO List." |
| 118 | end |
| 119 | |
| 120 | task :clean do |
| 121 | File.delete(".rubocop_todo.yml") if File.exists?(".rubocop_todo.yml") |
| 122 | end |
| 123 | end |
| 124 | |
| 125 | task :style => ['style:check'] |