Final assignment for the course "Real Time and Embedded Systems" of THMMY in AUTH university.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

106 lines
3.3 KiB

# ==============================================================================
# CMock Project - Automatic Mock Generation for C
# Copyright (c) 2007-2014 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==============================================================================
require '../config/test_environment'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require './rakefile_helper'
include RakefileHelpers
DEFAULT_CONFIG_FILE = 'gcc.yml'
CMOCK_TEST_ROOT = File.expand_path(File.dirname(__FILE__))
SYSTEM_TEST_SUPPORT_DIRS = [
File.join(CMOCK_TEST_ROOT, 'system/generated'),
File.join(CMOCK_TEST_ROOT, 'system/build')
]
SYSTEM_TEST_SUPPORT_DIRS.each do |dir|
directory(dir)
CLOBBER.include(dir)
end
task :prep_system_tests => SYSTEM_TEST_SUPPORT_DIRS
configure_clean
configure_toolchain(DEFAULT_CONFIG_FILE)
task :default => [:test]
task :ci => [:no_color, :default]
task :cruise => :ci
desc "Load configuration"
task :config, :config_file do |t, args|
args = {:config_file => DEFAULT_CONFIG_FILE} if args[:config_file].nil?
args = {:config_file => args[:config_file] + '.yml'} unless args[:config_file] =~ /\.yml$/i
configure_toolchain(args[:config_file])
end
desc "Run all unit, c, and system tests"
task :test => [:clobber, :prep_system_tests, 'test:units', 'test:c', 'test:system']
namespace :test do
desc "Run Unit Tests"
Rake::TestTask.new('units') do |t|
t.pattern = 'unit/*_test.rb'
t.verbose = true
end
#individual unit tests
FileList['unit/*_test.rb'].each do |test|
Rake::TestTask.new(File.basename(test,'.*').sub('_test','')) do |t|
t.pattern = test
t.verbose = true
end
end
desc "Run C Unit Tests"
task :c => [:prep_system_tests] do
unless ($cfg['unsupported'].include? "C")
build_and_test_c_files
end
end
desc "Run System Tests"
task :system => [:clobber, :prep_system_tests] do
#get a list of all system tests, removing unsupported tests for this compiler
sys_unsupported = $cfg['unsupported'].map {|a| 'system/test_interactions/'+a+'.yml'}
sys_tests_to_run = FileList['system/test_interactions/*.yml'] - sys_unsupported
compile_unsupported = $cfg['unsupported'].map {|a| SYSTEST_COMPILE_MOCKABLES_PATH+a+'.h'}
compile_tests_to_run = FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'] - compile_unsupported
unless (sys_unsupported.empty? and compile_unsupported.empty?)
report "\nIgnoring these system tests..."
sys_unsupported.each {|a| report a}
compile_unsupported.each {|a| report a}
end
report "\nRunning system tests..."
tests_failed = run_system_test_interactions(sys_tests_to_run)
raise "System tests failed." if (tests_failed > 0)
run_system_test_compilations(compile_tests_to_run)
end
#individual system tests
FileList['system/test_interactions/*.yml'].each do |test|
basename = File.basename(test,'.*')
desc "Run system test #{basename}"
task basename do
run_system_test_interactions([test])
end
end
desc "Profile Mock Generation"
task :profile => [:clobber, :prep_system_tests] do
run_system_test_profiles(FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'])
end
end
task :no_color do
$colour_output = false
end