making new flush routines work under all defined conditions.

This commit is contained in:
Mark VanderVoord
2016-06-21 10:01:34 -04:00
parent c19b5e20a0
commit b3bc196ab3
4 changed files with 29 additions and 24 deletions

View File

@ -2,7 +2,7 @@
# Unity Project - A Test Framework for C # Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details] # [Released under MIT License. Please refer to license.txt for details]
# ========================================== # ==========================================
# This script creates all the files with start code necessary for a new module. # This script creates all the files with start code necessary for a new module.
# A simple module only requires a source file, header file, and test file. # A simple module only requires a source file, header file, and test file.
@ -32,20 +32,20 @@ HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------",
#Built in patterns #Built in patterns
PATTERNS = { 'src' => {'' => { :inc => [] } }, PATTERNS = { 'src' => {'' => { :inc => [] } },
'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] },
'Hardware' => { :inc => [] } 'Hardware' => { :inc => [] }
}, },
'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] },
'Interrupt'=> { :inc => ['%1$sHardware.h'] }, 'Interrupt'=> { :inc => ['%1$sHardware.h'] },
'Hardware' => { :inc => [] } 'Hardware' => { :inc => [] }
}, },
'mch' => {'Model' => { :inc => [] }, 'mch' => {'Model' => { :inc => [] },
'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] },
'Hardware' => { :inc => [] } 'Hardware' => { :inc => [] }
}, },
'mvp' => {'Model' => { :inc => [] }, 'mvp' => {'Model' => { :inc => [] },
'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] },
'View' => { :inc => [] } 'View' => { :inc => [] }
} }
} }
@ -63,7 +63,7 @@ void tearDown(void)
void test_%1$s_NeedToImplement(void) void test_%1$s_NeedToImplement(void)
{ {
TEST_IGNORE(); TEST_IGNORE_MESSAGE("Need to Implement %1$s");
} }
] ]
@ -91,7 +91,7 @@ ARGV.each do |arg|
when /^(\w+)/ when /^(\w+)/
raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil?
@module_name = arg @module_name = arg
when /^-(h|-help)/ when /^-(h|-help)/
puts HELP_TEXT puts HELP_TEXT
exit exit
else else
@ -126,7 +126,7 @@ end
@includes.merge!(@extra_inc) unless @extra_inc.nil? @includes.merge!(@extra_inc) unless @extra_inc.nil?
#create triad definition #create triad definition
TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] },
{ :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] },
{ :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] },
] ]
@ -159,7 +159,7 @@ if @destroy
file = filespec[:path] file = filespec[:path]
if File.exist?(file) if File.exist?(file)
if @update_svn if @update_svn
`svn delete \"#{file}\" --force` `svn delete \"#{file}\" --force`
puts "File #{file} deleted and removed from source control" puts "File #{file} deleted and removed from source control"
else else
FileUtils.remove(file) FileUtils.remove(file)
@ -182,13 +182,13 @@ end
files.each_with_index do |file, i| files.each_with_index do |file, i|
File.open(file[:path], 'w') do |f| File.open(file[:path], 'w') do |f|
f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil?
f.write(file[:template] % [ file[:name], f.write(file[:template] % [ file[:name],
file[:includes].map{|f| "#include \"#{f}\"\n"}.join, file[:includes].map{|f| "#include \"#{f}\"\n"}.join,
file[:name].upcase ] file[:name].upcase ]
) )
end end
if (@update_svn) if (@update_svn)
`svn add \"#{file[:path]}\"` `svn add \"#{file[:path]}\"`
if $?.exitstatus == 0 if $?.exitstatus == 0
puts "File #{file[:path]} created and added to source control" puts "File #{file[:path]} created and added to source control"
else else

View File

@ -9,10 +9,7 @@
/* If omitted from header, declare overrideable prototypes here so they're ready for use */ /* If omitted from header, declare overrideable prototypes here so they're ready for use */
#ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION #ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
int UNITY_OUTPUT_CHAR(int); void UNITY_OUTPUT_CHAR(int);
#endif
#ifdef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
int UNITY_OUTPUT_FLUSH(void);
#endif #endif
/* Helpful macros for us to use here */ /* Helpful macros for us to use here */
@ -338,7 +335,7 @@ void UnityConcludeTest(void)
Unity.CurrentTestFailed = 0; Unity.CurrentTestFailed = 0;
Unity.CurrentTestIgnored = 0; Unity.CurrentTestIgnored = 0;
UNITY_PRINT_EOL(); UNITY_PRINT_EOL();
UNITY_OUTPUT_FLUSH(); UNITY_FLUSH_CALL();
} }
/*-----------------------------------------------*/ /*-----------------------------------------------*/
@ -1298,7 +1295,7 @@ int UnityEnd(void)
#endif #endif
} }
UNITY_PRINT_EOL(); UNITY_PRINT_EOL();
UNITY_OUTPUT_FLUSH(); UNITY_FLUSH_CALL();
UNITY_OUTPUT_COMPLETE(); UNITY_OUTPUT_COMPLETE();
return (int)(Unity.TestFailures); return (int)(Unity.TestFailures);
} }

View File

@ -299,9 +299,9 @@ extern void UNITY_OUTPUT_CHAR(int);
#endif #endif
#ifndef UNITY_OUTPUT_FLUSH #ifndef UNITY_OUTPUT_FLUSH
/* Default to using putchar, which is defined in stdio.h */ /* Default to using fflush, which is defined in stdio.h */
#include <stdio.h> #include <stdio.h>
#define UNITY_OUTPUT_FLUSH() (void)fflush(stdout) #define UNITY_OUTPUT_FLUSH (void)fflush(stdout)
#else #else
/* If defined as something else, make sure we declare it here so it's ready for use */ /* If defined as something else, make sure we declare it here so it's ready for use */
#ifndef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION #ifndef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
@ -309,6 +309,12 @@ extern void UNITY_OUTPUT_FLUSH(void);
#endif #endif
#endif #endif
#ifndef UNITY_OUTPUT_FLUSH
#define UNITY_FLUSH_CALL()
#else
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH
#endif
#ifndef UNITY_PRINT_EOL #ifndef UNITY_PRINT_EOL
#define UNITY_PRINT_EOL() UNITY_OUTPUT_CHAR('\n') #define UNITY_PRINT_EOL() UNITY_OUTPUT_CHAR('\n')
#endif #endif

View File

@ -60,6 +60,8 @@ compiler:
- UNITY_INCLUDE_DOUBLE - UNITY_INCLUDE_DOUBLE
- UNITY_SUPPORT_TEST_CASES - UNITY_SUPPORT_TEST_CASES
- UNITY_SUPPORT_64 - UNITY_SUPPORT_64
- UNITY_OUTPUT_FLUSH
- UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
object_files: object_files:
prefix: '-o' prefix: '-o'
extension: '.o' extension: '.o'