From 1a868f3305e3ec640b3752da0fff475457269365 Mon Sep 17 00:00:00 2001 From: "@gageas" Date: Mon, 10 Nov 2014 00:50:09 +0900 Subject: [PATCH 01/14] Declare local variables before if statement. --- src/unity.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unity.c b/src/unity.c index ad3ccb8..d9e0821 100644 --- a/src/unity.c +++ b/src/unity.c @@ -643,13 +643,13 @@ void UnityAssertFloatSpecial(const _UF actual, const UNITY_LINE_TYPE lineNumber, const UNITY_FLOAT_TRAIT_T style) { - UNITY_SKIP_EXECUTION; - const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet }; _U_SINT should_be_trait = ((_U_SINT)style & 1); _U_SINT is_trait = !should_be_trait; _U_SINT trait_index = style >> 1; + UNITY_SKIP_EXECUTION; + switch(style) { //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly @@ -803,13 +803,13 @@ void UnityAssertDoubleSpecial(const _UD actual, const UNITY_LINE_TYPE lineNumber, const UNITY_FLOAT_TRAIT_T style) { - UNITY_SKIP_EXECUTION; - const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet }; _U_SINT should_be_trait = ((_U_SINT)style & 1); _U_SINT is_trait = !should_be_trait; _U_SINT trait_index = style >> 1; + UNITY_SKIP_EXECUTION; + switch(style) { //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly From 1aeb4468afe6d964d6af5ecfc19e69900e302ea6 Mon Sep 17 00:00:00 2001 From: kotofos Date: Wed, 3 Dec 2014 11:51:58 +0600 Subject: [PATCH 02/14] putchar warning --- extras/fixture/src/unity_fixture.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/fixture/src/unity_fixture.c b/extras/fixture/src/unity_fixture.c index 04a4c69..5c7400e 100644 --- a/extras/fixture/src/unity_fixture.c +++ b/extras/fixture/src/unity_fixture.c @@ -6,6 +6,7 @@ ========================================== */ #include +#include #include "unity_fixture.h" #include "unity_internals.h" From f6bb716220d6e54e639299acc3e22a159c02ae25 Mon Sep 17 00:00:00 2001 From: kotofos Date: Wed, 3 Dec 2014 11:53:16 +0600 Subject: [PATCH 03/14] default case warning --- src/unity.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/unity.c b/src/unity.c index d9e0821..d75f857 100644 --- a/src/unity.c +++ b/src/unity.c @@ -677,6 +677,8 @@ void UnityAssertFloatSpecial(const _UF actual, else is_trait = 1; break; + default: + ; } if (is_trait != should_be_trait) @@ -837,6 +839,8 @@ void UnityAssertDoubleSpecial(const _UD actual, else is_trait = 1; break; + default: + ; } if (is_trait != should_be_trait) From c1379802ebb9bb88d69a94207e6e48222c8da668 Mon Sep 17 00:00:00 2001 From: kotofos Date: Wed, 3 Dec 2014 11:58:08 +0600 Subject: [PATCH 04/14] no arguments for UnityPointer_Init --- extras/fixture/test/unity_fixture_Test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/fixture/test/unity_fixture_Test.c b/extras/fixture/test/unity_fixture_Test.c index 12f3947..e912f9a 100644 --- a/extras/fixture/test/unity_fixture_Test.c +++ b/extras/fixture/test/unity_fixture_Test.c @@ -122,7 +122,7 @@ TEST(UnityFixture, PointerSet) p1 = &c1; p2 = &c2; - UnityPointer_Init(10); + UnityPointer_Init(); UT_PTR_SET(p1, &newC1); UT_PTR_SET(p2, &newC2); TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); From a94264b8c039a289e6436b5648de366844bd7d86 Mon Sep 17 00:00:00 2001 From: "Zane D. Purvis" Date: Mon, 4 Aug 2014 12:37:22 -0400 Subject: [PATCH 05/14] Print newline after each test, but not before This change makes parsing the results easier for tools like ceedling, which was choking when a test used stdout and there wasn't an EOL after "PASS" (ThrowTheSwitch/Ceedling#41). --- src/unity.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/unity.c b/src/unity.c index d9e0821..8946110 100644 --- a/src/unity.c +++ b/src/unity.c @@ -273,7 +273,6 @@ void UnityPrintOk(void) //----------------------------------------------- void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) { - UNITY_PRINT_EOL; UnityPrint(file); UNITY_OUTPUT_CHAR(':'); UnityPrintNumber((_U_SINT)line); @@ -309,6 +308,7 @@ void UnityConcludeTest(void) Unity.CurrentTestFailed = 0; Unity.CurrentTestIgnored = 0; + UNITY_PRINT_EOL; } //----------------------------------------------- @@ -1164,5 +1164,3 @@ int UnityEnd(void) } //----------------------------------------------- - - From 6792a5f4ed2e2602fea53e667496b314a8c0b611 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Tue, 9 Dec 2014 12:05:53 -0500 Subject: [PATCH 06/14] Updated License to be standard MIT License --- docs/license.txt | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/docs/license.txt b/docs/license.txt index e2ef951..d0f635f 100644 --- a/docs/license.txt +++ b/docs/license.txt @@ -1,31 +1,21 @@ - Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams +The MIT License (MIT) - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, - copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following - conditions: +Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - The end-user documentation included with the redistribution, if - any, must include the following acknowledgment: "This product - includes software developed for the Unity Project, by Mike Karlesky, - Mark VanderVoord, and Greg Williams and other contributors", in - the same place and form as other third-party acknowledgments. - Alternately, this acknowledgment may appear in the software - itself, in the same form and location as other such third-party - acknowledgments. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. From cadee02e792bbb50b63c1fe881664e175a61d901 Mon Sep 17 00:00:00 2001 From: "Zane D. Purvis" Date: Mon, 15 Dec 2014 16:02:59 -0500 Subject: [PATCH 07/14] New macros for controlling use of weak linkage - `UNITY_WEAK_ATTRIBUTE`, if defined, is placed before declarations of weakly linked symbols. If not manually defined, it will be automatically set to `__attribute__((weak))` on GCC and Clang, except for Clang for Win32. - `UNITY_WEAK_PRAGMA`, if defined, will cause preprocessor to emit `#pragma weak setUp`, etc. Ignored if `UNITY_WEAK_ATTRIBUTE` is defined. - `UNITY_NO_WEAK` undefines both of the above resulting in no weakly linked symbols. Work around for ThrowTheSwitch/Unity#93 --- src/unity.c | 15 ++++++++++----- src/unity_internals.h | 21 +++++++++------------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/unity.c b/src/unity.c index 4525924..fd92e71 100644 --- a/src/unity.c +++ b/src/unity.c @@ -1101,12 +1101,17 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) } //----------------------------------------------- -#ifdef UNITY_SUPPORT_WEAK -UNITY_WEAK void setUp(void) { } -UNITY_WEAK void tearDown(void) { } +#if defined(UNITY_WEAK_ATTRIBUTE) + UNITY_WEAK_ATTRIBUTE void setUp(void) { } + UNITY_WEAK_ATTRIBUTE void tearDown(void) { } +#elif defined(UNITY_WEAK_PRAGMA) +# pragma weak setUp + void setUp(void); +# pragma weak tearDown + void tearDown(void); #else -void setUp(void); -void tearDown(void); + void setUp(void); + void tearDown(void); #endif //----------------------------------------------- void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) diff --git a/src/unity_internals.h b/src/unity_internals.h index 4695dbf..1552915 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -292,22 +292,19 @@ extern int UNITY_OUTPUT_CHAR(int); //------------------------------------------------------- // Language Features Available //------------------------------------------------------- - -#ifdef __GNUC__ -#define UNITY_SUPPORT_WEAK __attribute__((weak)) +#if !defined(UNITY_WEAK_ATTRIBUTE) && !defined(UNITY_WEAK_PRAGMA) +# ifdef __GNUC__ // includes clang +# if !(defined(__WIN32__) && defined(__clang__)) +# define UNITY_WEAK_ATTRIBUTE __attribute__((weak)) +# endif +# endif #endif -#ifdef __clang__ -#define UNITY_SUPPORT_WEAK __attribute__((weak)) +#ifdef UNITY_NO_WEAK +# undef UNITY_WEAK_ATTRIBUTE +# undef UNITY_WEAK_PRAGMA #endif -#ifndef UNITY_WEAK -#ifdef UNITY_SUPPORT_WEAK -#define UNITY_WEAK UNITY_SUPPORT_WEAK -#else -#define UNITY_WEAK -#endif -#endif //------------------------------------------------------- // Internal Structs Needed From 024af1672c2cfb9125c985378c0af970b3cde758 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Tue, 16 Dec 2014 14:17:56 -0500 Subject: [PATCH 08/14] - update rake file for fixture to match other changes. --- extras/fixture/rakefile.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/extras/fixture/rakefile.rb b/extras/fixture/rakefile.rb index 5d81e72..8c758fc 100644 --- a/extras/fixture/rakefile.rb +++ b/extras/fixture/rakefile.rb @@ -2,7 +2,7 @@ # Unity Project - A Test Framework for C # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams # [Released under MIT License. Please refer to license.txt for details] -# ========================================== +# ========================================== HERE = File.expand_path(File.dirname(__FILE__)) + '/' @@ -11,13 +11,24 @@ require 'rake/clean' require 'rake/testtask' require HERE + 'rakefile_helper' +TEMP_DIRS = [ + File.join(HERE, 'build') +] + +TEMP_DIRS.each do |dir| + directory(dir) + CLOBBER.include(dir) +end + +task :prepare_for_tests => TEMP_DIRS + include RakefileHelpers # Load default configuration, for now -DEFAULT_CONFIG_FILE = 'gcc_32.yml' +DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml' configure_toolchain(DEFAULT_CONFIG_FILE) -task :unit do +task :unit => [:prepare_for_tests] do run_tests end From af40e7901d44f6cdb8db94e5fde3ce31c598f7e9 Mon Sep 17 00:00:00 2001 From: nimrodz Date: Sun, 18 Jan 2015 00:25:04 +0200 Subject: [PATCH 09/14] Added a few files to .gitignore. --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 880ac59..fbdf49e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ build/ .DS_Store +examples/example_1/test1.out +examples/example_1/test2.out +examples/example_2/all_tests.out +examples/example_3/test1.out +examples/example_3/test2.out From b389c71e7113580de035e6e3eff70b7b01d64bdb Mon Sep 17 00:00:00 2001 From: nimrodz Date: Sun, 18 Jan 2015 00:32:47 +0200 Subject: [PATCH 10/14] Added stricter error checks by the compiler, and adapted all impacted code. Primarily - * Added "static" to static functions. * Added proper signature with "void" to functions without arguments. * Marked unused arguments with "(void)". * Removed entirely unused static functions. * Added "const" to preserve const-correctness. * Added function prototypes for external functions. --- examples/example_1/makefile | 19 +++++++++++++++ examples/example_1/src/ProductionCode2.c | 2 ++ .../test_runners/TestProductionCode2_Runner.c | 13 ---------- .../test_runners/TestProductionCode_Runner.c | 13 ---------- examples/example_2/makefile | 24 ++++++++++++++++++- examples/example_2/src/ProductionCode2.c | 2 ++ examples/example_3/makefile | 19 +++++++++++++++ examples/example_3/src/ProductionCode2.c | 2 ++ .../test/no_ruby/TestProductionCode2_Runner.c | 13 ---------- .../test/no_ruby/TestProductionCode_Runner.c | 13 ---------- extras/fixture/src/unity_fixture.c | 22 +++++++++-------- extras/fixture/src/unity_fixture.h | 12 ++++++---- extras/fixture/src/unity_fixture_internals.h | 2 +- .../src/unity_fixture_malloc_overrides.h | 5 ++++ extras/fixture/test/main/AllTests.c | 4 ++-- extras/fixture/test/unity_fixture_Test.c | 16 ++++++------- extras/fixture/test/unity_output_Spy.c | 4 ++-- extras/fixture/test/unity_output_Spy.h | 4 ++-- src/unity.c | 12 ++++++---- test/targets/gcc_auto_stdint.yml | 16 +++++++++++++ 20 files changed, 130 insertions(+), 87 deletions(-) diff --git a/examples/example_1/makefile b/examples/example_1/makefile index 84696a1..3d8d763 100644 --- a/examples/example_1/makefile +++ b/examples/example_1/makefile @@ -21,7 +21,26 @@ endif UNITY_ROOT=../.. C_COMPILER=gcc + CFLAGS=-std=c99 +CFLAGS += -Wall +CFLAGS += -Wextra +CFLAGS += -Werror +CFLAGS += -Wpointer-arith +CFLAGS += -Wcast-align +CFLAGS += -Wwrite-strings +CFLAGS += -Wswitch-default +CFLAGS += -Wunreachable-code +CFLAGS += -Winit-self +CFLAGS += -Wlogical-op +CFLAGS += -Wmissing-field-initializers +CFLAGS += -Wno-unknown-pragmas +CFLAGS += -Wjump-misses-init +CFLAGS += -Wstrict-prototypes +CFLAGS += -Wundef +CFLAGS += -Wunsafe-loop-optimizations +CFLAGS += -Wold-style-definition + TARGET_BASE1=test1 TARGET_BASE2=test2 TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) diff --git a/examples/example_1/src/ProductionCode2.c b/examples/example_1/src/ProductionCode2.c index a8c72e1..77c969f 100644 --- a/examples/example_1/src/ProductionCode2.c +++ b/examples/example_1/src/ProductionCode2.c @@ -3,6 +3,8 @@ char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) { + (void)Poor; + (void)LittleFunction; //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget return (char*)0; diff --git a/examples/example_1/test/test_runners/TestProductionCode2_Runner.c b/examples/example_1/test/test_runners/TestProductionCode2_Runner.c index 01926b1..4d67701 100644 --- a/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +++ b/examples/example_1/test/test_runners/TestProductionCode2_Runner.c @@ -12,18 +12,6 @@ extern void test_IgnoredTest(void); extern void test_AnotherIgnoredTest(void); extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); -static void runTest(UnityTestFunction test) -{ - if (TEST_PROTECT()) - { - setUp(); - test(); - } - if (TEST_PROTECT() && !TEST_IS_IGNORED) - { - tearDown(); - } -} void resetTest(void); void resetTest(void) { @@ -36,7 +24,6 @@ int main(void) { UnityBegin("test/TestProductionCode2.c"); - // RUN_TEST calls runTest RUN_TEST(test_IgnoredTest, 13); RUN_TEST(test_AnotherIgnoredTest, 18); RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); diff --git a/examples/example_1/test/test_runners/TestProductionCode_Runner.c b/examples/example_1/test/test_runners/TestProductionCode_Runner.c index 844c793..0a795ec 100644 --- a/examples/example_1/test/test_runners/TestProductionCode_Runner.c +++ b/examples/example_1/test/test_runners/TestProductionCode_Runner.c @@ -14,18 +14,6 @@ extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounter extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); -static void runTest(UnityTestFunction test) -{ - if (TEST_PROTECT()) - { - setUp(); - test(); - } - if (TEST_PROTECT() && !TEST_IS_IGNORED) - { - tearDown(); - } -} void resetTest(void); void resetTest(void) { @@ -38,7 +26,6 @@ int main(void) { UnityBegin("test/TestProductionCode.c"); - // RUN_TEST calls runTest RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); diff --git a/examples/example_2/makefile b/examples/example_2/makefile index 3eaa776..311e8ce 100644 --- a/examples/example_2/makefile +++ b/examples/example_2/makefile @@ -21,6 +21,28 @@ endif UNITY_ROOT=../.. C_COMPILER=gcc + +CFLAGS = -std=c99 +CFLAGS += -Wall +CFLAGS += -Wextra +CFLAGS += -Werror +CFLAGS += -Wpointer-arith +CFLAGS += -Wcast-align +CFLAGS += -Wwrite-strings +CFLAGS += -Wswitch-default +CFLAGS += -Wunreachable-code +CFLAGS += -Winit-self +CFLAGS += -Wlogical-op +CFLAGS += -Wmissing-field-initializers +CFLAGS += -Wno-unknown-pragmas +CFLAGS += -Wjump-misses-init +CFLAGS += -Wstrict-prototypes +CFLAGS += -Wundef +CFLAGS += -Wunsafe-loop-optimizations +CFLAGS += -Wold-style-definition +CFLAGS += -Wmissing-prototypes +CFLAGS += -Wmissing-declarations + TARGET_BASE1=all_tests TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) SRC_FILES1=\ @@ -41,7 +63,7 @@ all: clean default default: # ruby auto/generate_test_runner.rb test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c # ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c - $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) ./$(TARGET1) clean: diff --git a/examples/example_2/src/ProductionCode2.c b/examples/example_2/src/ProductionCode2.c index a8c72e1..77c969f 100644 --- a/examples/example_2/src/ProductionCode2.c +++ b/examples/example_2/src/ProductionCode2.c @@ -3,6 +3,8 @@ char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) { + (void)Poor; + (void)LittleFunction; //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget return (char*)0; diff --git a/examples/example_3/makefile b/examples/example_3/makefile index fb5140c..aa485f3 100644 --- a/examples/example_3/makefile +++ b/examples/example_3/makefile @@ -21,7 +21,26 @@ endif UNITY_ROOT=../.. C_COMPILER=gcc + CFLAGS=-std=c99 +CFLAGS += -Wall +CFLAGS += -Wextra +CFLAGS += -Werror +CFLAGS += -Wpointer-arith +CFLAGS += -Wcast-align +CFLAGS += -Wwrite-strings +CFLAGS += -Wswitch-default +CFLAGS += -Wunreachable-code +CFLAGS += -Winit-self +CFLAGS += -Wlogical-op +CFLAGS += -Wmissing-field-initializers +CFLAGS += -Wno-unknown-pragmas +CFLAGS += -Wjump-misses-init +CFLAGS += -Wstrict-prototypes +CFLAGS += -Wundef +CFLAGS += -Wunsafe-loop-optimizations +CFLAGS += -Wold-style-definition + TARGET_BASE1=test1 TARGET_BASE2=test2 TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) diff --git a/examples/example_3/src/ProductionCode2.c b/examples/example_3/src/ProductionCode2.c index a8c72e1..77c969f 100644 --- a/examples/example_3/src/ProductionCode2.c +++ b/examples/example_3/src/ProductionCode2.c @@ -3,6 +3,8 @@ char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) { + (void)Poor; + (void)LittleFunction; //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget return (char*)0; diff --git a/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c b/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c index 01926b1..4d67701 100644 --- a/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +++ b/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c @@ -12,18 +12,6 @@ extern void test_IgnoredTest(void); extern void test_AnotherIgnoredTest(void); extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); -static void runTest(UnityTestFunction test) -{ - if (TEST_PROTECT()) - { - setUp(); - test(); - } - if (TEST_PROTECT() && !TEST_IS_IGNORED) - { - tearDown(); - } -} void resetTest(void); void resetTest(void) { @@ -36,7 +24,6 @@ int main(void) { UnityBegin("test/TestProductionCode2.c"); - // RUN_TEST calls runTest RUN_TEST(test_IgnoredTest, 13); RUN_TEST(test_AnotherIgnoredTest, 18); RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); diff --git a/examples/example_3/test/no_ruby/TestProductionCode_Runner.c b/examples/example_3/test/no_ruby/TestProductionCode_Runner.c index 844c793..0a795ec 100644 --- a/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +++ b/examples/example_3/test/no_ruby/TestProductionCode_Runner.c @@ -14,18 +14,6 @@ extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounter extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); -static void runTest(UnityTestFunction test) -{ - if (TEST_PROTECT()) - { - setUp(); - test(); - } - if (TEST_PROTECT() && !TEST_IS_IGNORED) - { - tearDown(); - } -} void resetTest(void); void resetTest(void) { @@ -38,7 +26,6 @@ int main(void) { UnityBegin("test/TestProductionCode.c"); - // RUN_TEST calls runTest RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); diff --git a/extras/fixture/src/unity_fixture.c b/extras/fixture/src/unity_fixture.c index 5c7400e..a089b5a 100644 --- a/extras/fixture/src/unity_fixture.c +++ b/extras/fixture/src/unity_fixture.c @@ -17,10 +17,12 @@ int (*outputChar)(int) = putchar; int verbose = 0; +void setUp(void); +void tearDown(void); void setUp(void) { /*does nothing*/ } void tearDown(void) { /*does nothing*/ } -void announceTestRun(unsigned int runNumber) +static void announceTestRun(unsigned int runNumber) { UnityPrint("Unity test run "); UnityPrintNumber(runNumber+1); @@ -29,7 +31,7 @@ void announceTestRun(unsigned int runNumber) UNITY_OUTPUT_CHAR('\n'); } -int UnityMain(int argc, char* argv[], void (*runAllTests)(void)) +int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)) { int result = UnityGetCommandLineOptions(argc, argv); unsigned int r; @@ -65,7 +67,7 @@ static int groupSelected(const char* group) return selected(UnityFixture.GroupFilter, group); } -static void runTestCase() +static void runTestCase(void) { } @@ -132,13 +134,13 @@ void UnityIgnoreTest(const char * printableName) static int malloc_count; static int malloc_fail_countdown = MALLOC_DONT_FAIL; -void UnityMalloc_StartTest() +void UnityMalloc_StartTest(void) { malloc_count = 0; malloc_fail_countdown = MALLOC_DONT_FAIL; } -void UnityMalloc_EndTest() +void UnityMalloc_EndTest(void) { malloc_fail_countdown = MALLOC_DONT_FAIL; if (malloc_count != 0) @@ -274,7 +276,7 @@ enum {MAX_POINTERS=50}; static PointerPair pointer_store[MAX_POINTERS]; static int pointer_index = 0; -void UnityPointer_Init() +void UnityPointer_Init(void) { pointer_index = 0; } @@ -290,7 +292,7 @@ void UnityPointer_Set(void ** pointer, void * newValue) pointer_index++; } -void UnityPointer_UndoAllSets() +void UnityPointer_UndoAllSets(void) { while (pointer_index > 0) { @@ -301,12 +303,12 @@ void UnityPointer_UndoAllSets() } } -int UnityFailureCount() +int UnityFailureCount(void) { return Unity.TestFailures; } -int UnityGetCommandLineOptions(int argc, char* argv[]) +int UnityGetCommandLineOptions(int argc, const char* argv[]) { int i; UnityFixture.Verbose = 0; @@ -360,7 +362,7 @@ int UnityGetCommandLineOptions(int argc, char* argv[]) return 0; } -void UnityConcludeFixtureTest() +void UnityConcludeFixtureTest(void) { if (Unity.CurrentTestIgnored) { diff --git a/extras/fixture/src/unity_fixture.h b/extras/fixture/src/unity_fixture.h index 3f54c14..e176bbd 100644 --- a/extras/fixture/src/unity_fixture.h +++ b/extras/fixture/src/unity_fixture.h @@ -13,19 +13,22 @@ #include "unity_fixture_malloc_overrides.h" #include "unity_fixture_internals.h" -int UnityMain(int argc, char* argv[], void (*runAllTests)(void)); +int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)); #define TEST_GROUP(group)\ static const char* TEST_GROUP_##group = #group -#define TEST_SETUP(group) void TEST_##group##_SETUP(void) +#define TEST_SETUP(group) void TEST_##group##_SETUP(void);\ + void TEST_##group##_SETUP(void) -#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN(void) +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN(void);\ + void TEST_##group##_TEAR_DOWN(void) #define TEST(group, name) \ void TEST_##group##_##name##_(void);\ + void TEST_##group##_##name##_run(void);\ void TEST_##group##_##name##_run(void)\ {\ UnityTestRunner(TEST_##group##_SETUP,\ @@ -39,6 +42,7 @@ int UnityMain(int argc, char* argv[], void (*runAllTests)(void)); #define IGNORE_TEST(group, name) \ void TEST_##group##_##name##_(void);\ + void TEST_##group##_##name##_run(void);\ void TEST_##group##_##name##_run(void)\ {\ UnityIgnoreTest("IGNORE_TEST(" #group ", " #name ")");\ @@ -60,7 +64,7 @@ int UnityMain(int argc, char* argv[], void (*runAllTests)(void)); {\ TEST_##group##_GROUP_RUNNER_runAll();\ }\ - void TEST_##group##_GROUP_RUNNER_runAll() + void TEST_##group##_GROUP_RUNNER_runAll(void) //Call this from main #define RUN_TEST_GROUP(group)\ diff --git a/extras/fixture/src/unity_fixture_internals.h b/extras/fixture/src/unity_fixture_internals.h index 704bccd..c4099fa 100644 --- a/extras/fixture/src/unity_fixture_internals.h +++ b/extras/fixture/src/unity_fixture_internals.h @@ -29,7 +29,7 @@ void UnityIgnoreTest(const char * printableName); void UnityMalloc_StartTest(void); void UnityMalloc_EndTest(void); int UnityFailureCount(void); -int UnityGetCommandLineOptions(int argc, char* argv[]); +int UnityGetCommandLineOptions(int argc, const char* argv[]); void UnityConcludeFixtureTest(void); void UnityPointer_Set(void ** ptr, void * newValue); diff --git a/extras/fixture/src/unity_fixture_malloc_overrides.h b/extras/fixture/src/unity_fixture_malloc_overrides.h index 38f8e34..1e10014 100644 --- a/extras/fixture/src/unity_fixture_malloc_overrides.h +++ b/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -13,4 +13,9 @@ #define realloc unity_realloc #define free unity_free +void* unity_malloc(size_t size); +void* unity_calloc(size_t num, size_t size); +void* unity_realloc(void * oldMem, size_t size); +void unity_free(void * mem); + #endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/extras/fixture/test/main/AllTests.c b/extras/fixture/test/main/AllTests.c index ccb775b..7d0577e 100644 --- a/extras/fixture/test/main/AllTests.c +++ b/extras/fixture/test/main/AllTests.c @@ -7,14 +7,14 @@ #include "unity_fixture.h" -static void runAllTests() +static void runAllTests(void) { RUN_TEST_GROUP(UnityFixture); RUN_TEST_GROUP(UnityCommandOptions); RUN_TEST_GROUP(LeakDetection) } -int main(int argc, char* argv[]) +int main(int argc, const char* argv[]) { return UnityMain(argc, argv, runAllTests); } diff --git a/extras/fixture/test/unity_fixture_Test.c b/extras/fixture/test/unity_fixture_Test.c index e912f9a..1f209e9 100644 --- a/extras/fixture/test/unity_fixture_Test.c +++ b/extras/fixture/test/unity_fixture_Test.c @@ -158,7 +158,7 @@ TEST_TEAR_DOWN(UnityCommandOptions) } -static char* noOptions[] = { +static const char* noOptions[] = { "testrunner.exe" }; @@ -171,7 +171,7 @@ TEST(UnityCommandOptions, DefaultOptions) TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); } -static char* verbose[] = { +static const char* verbose[] = { "testrunner.exe", "-v" }; @@ -182,7 +182,7 @@ TEST(UnityCommandOptions, OptionVerbose) TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); } -static char* group[] = { +static const char* group[] = { "testrunner.exe", "-g", "groupname" }; @@ -193,7 +193,7 @@ TEST(UnityCommandOptions, OptionSelectTestByGroup) STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); } -static char* name[] = { +static const char* name[] = { "testrunner.exe", "-n", "testname" }; @@ -204,7 +204,7 @@ TEST(UnityCommandOptions, OptionSelectTestByName) STRCMP_EQUAL("testname", UnityFixture.NameFilter); } -static char* repeat[] = { +static const char* repeat[] = { "testrunner.exe", "-r", "99" }; @@ -221,7 +221,7 @@ TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); } -static char* multiple[] = { +static const char* multiple[] = { "testrunner.exe", "-v", "-g", "groupname", @@ -238,7 +238,7 @@ TEST(UnityCommandOptions, MultipleOptions) TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); } -static char* dashRNotLast[] = { +static const char* dashRNotLast[] = { "testrunner.exe", "-v", "-g", "gggg", @@ -255,7 +255,7 @@ TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); } -static char* unknownCommand[] = { +static const char* unknownCommand[] = { "testrunner.exe", "-v", "-g", "groupname", diff --git a/extras/fixture/test/unity_output_Spy.c b/extras/fixture/test/unity_output_Spy.c index 16faefa..0a0ad04 100644 --- a/extras/fixture/test/unity_output_Spy.c +++ b/extras/fixture/test/unity_output_Spy.c @@ -25,7 +25,7 @@ void UnityOutputCharSpy_Create(int s) memset(buffer, 0, size); } -void UnityOutputCharSpy_Destroy() +void UnityOutputCharSpy_Destroy(void) { size = 0; free(buffer); @@ -45,7 +45,7 @@ int UnityOutputCharSpy_OutputChar(int c) return c; } -const char * UnityOutputCharSpy_Get() +const char * UnityOutputCharSpy_Get(void) { return buffer; } diff --git a/extras/fixture/test/unity_output_Spy.h b/extras/fixture/test/unity_output_Spy.h index 7c1590e..791f6a5 100644 --- a/extras/fixture/test/unity_output_Spy.h +++ b/extras/fixture/test/unity_output_Spy.h @@ -9,9 +9,9 @@ #define D_unity_output_Spy_H void UnityOutputCharSpy_Create(int s); -void UnityOutputCharSpy_Destroy(); +void UnityOutputCharSpy_Destroy(void); int UnityOutputCharSpy_OutputChar(int c); -const char * UnityOutputCharSpy_Get(); +const char * UnityOutputCharSpy_Get(void); void UnityOutputCharSpy_Enable(int enable); #endif diff --git a/src/unity.c b/src/unity.c index fd92e71..d349f6e 100644 --- a/src/unity.c +++ b/src/unity.c @@ -271,7 +271,7 @@ void UnityPrintOk(void) } //----------------------------------------------- -void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) { UnityPrint(file); UNITY_OUTPUT_CHAR(':'); @@ -282,7 +282,7 @@ void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) } //----------------------------------------------- -void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) { UnityTestResultsBegin(Unity.TestFile, line); UnityPrint(UnityStrFail); @@ -312,7 +312,7 @@ void UnityConcludeTest(void) } //----------------------------------------------- -void UnityAddMsgIfSpecified(const char* msg) +static void UnityAddMsgIfSpecified(const char* msg) { if (msg) { @@ -322,7 +322,7 @@ void UnityAddMsgIfSpecified(const char* msg) } //----------------------------------------------- -void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) { UnityPrint(UnityStrExpected); if (expected != NULL) @@ -352,7 +352,7 @@ void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual // Assertion & Control Helpers //----------------------------------------------- -int UnityCheckArraysForNull(UNITY_PTR_ATTRIBUTE const void* expected, UNITY_PTR_ATTRIBUTE const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +static int UnityCheckArraysForNull(UNITY_PTR_ATTRIBUTE const void* expected, UNITY_PTR_ATTRIBUTE const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) { //return true if they are both NULL if ((expected == NULL) && (actual == NULL)) @@ -1102,6 +1102,8 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) //----------------------------------------------- #if defined(UNITY_WEAK_ATTRIBUTE) + void setUp(void); + void tearDown(void); UNITY_WEAK_ATTRIBUTE void setUp(void) { } UNITY_WEAK_ATTRIBUTE void tearDown(void) { } #elif defined(UNITY_WEAK_PRAGMA) diff --git a/test/targets/gcc_auto_stdint.yml b/test/targets/gcc_auto_stdint.yml index 855f587..4e642c1 100644 --- a/test/targets/gcc_auto_stdint.yml +++ b/test/targets/gcc_auto_stdint.yml @@ -10,6 +10,22 @@ compiler: - '-Wno-address' - '-std=c99' - '-pedantic' + - '-Wextra' + - '-Werror' + - '-Wpointer-arith' + - '-Wcast-align' + - '-Wwrite-strings' + - '-Wswitch-default' + - '-Wunreachable-code' + - '-Winit-self' + - '-Wlogical-op' + - '-Wmissing-field-initializers' + - '-Wno-unknown-pragmas' + - '-Wjump-misses-init' + - '-Wstrict-prototypes' + - '-Wundef' + - '-Wunsafe-loop-optimizations' + - '-Wold-style-definition' includes: prefix: '-I' items: From 5f77c6380d4ed0d0820987126dc485859422b2f1 Mon Sep 17 00:00:00 2001 From: nimrodz Date: Tue, 20 Jan 2015 16:11:19 +0200 Subject: [PATCH 11/14] Added "const" to one argv parameter that was missed when adding strict error checks. --- examples/example_2/test/test_runners/all_tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/example_2/test/test_runners/all_tests.c b/examples/example_2/test/test_runners/all_tests.c index 29259be..e706ece 100644 --- a/examples/example_2/test/test_runners/all_tests.c +++ b/examples/example_2/test/test_runners/all_tests.c @@ -6,7 +6,7 @@ static void RunAllTests(void) RUN_TEST_GROUP(ProductionCode2); } -int main(int argc, char * argv[]) +int main(int argc, const char * argv[]) { return UnityMain(argc, argv, RunAllTests); -} \ No newline at end of file +} From 1c5986bd3042d5303f456c7d323c28891a7d7074 Mon Sep 17 00:00:00 2001 From: "@gageas" Date: Mon, 2 Feb 2015 23:57:07 +0900 Subject: [PATCH 12/14] undef defined callc/realloc macros --- extras/fixture/src/unity_fixture.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extras/fixture/src/unity_fixture.c b/extras/fixture/src/unity_fixture.c index a089b5a..b7a7de0 100644 --- a/extras/fixture/src/unity_fixture.c +++ b/extras/fixture/src/unity_fixture.c @@ -162,6 +162,14 @@ void UnityMalloc_MakeMallocFailAfterCount(int countdown) #undef free #endif +#ifdef calloc +#undef calloc +#endif + +#ifdef realloc +#undef realloc +#endif + #include #include From 975e222aaeb48474ea216bd3c6c4414ca019fd4b Mon Sep 17 00:00:00 2001 From: "@gageas" Date: Tue, 3 Feb 2015 00:19:30 +0900 Subject: [PATCH 13/14] Move announceTestRun() after UnityBegin() --- extras/fixture/src/unity_fixture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/fixture/src/unity_fixture.c b/extras/fixture/src/unity_fixture.c index b7a7de0..6bdbe5b 100644 --- a/extras/fixture/src/unity_fixture.c +++ b/extras/fixture/src/unity_fixture.c @@ -40,8 +40,8 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)) for (r = 0; r < UnityFixture.RepeatCount; r++) { - announceTestRun(r); UnityBegin(argv[0]); + announceTestRun(r); runAllTests(); UNITY_OUTPUT_CHAR('\n'); UnityEnd(); From 0f4ea8906b7e9bd136463991cf64eb91b3922bad Mon Sep 17 00:00:00 2001 From: Alexander Mueller Date: Wed, 11 Feb 2015 16:06:03 +0100 Subject: [PATCH 14/14] Add a port of unity_test_summary.rb to Python Useful in environments without access to ruby --- auto/unity_test_summary.py | 135 +++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 auto/unity_test_summary.py diff --git a/auto/unity_test_summary.py b/auto/unity_test_summary.py new file mode 100644 index 0000000..7426ec8 --- /dev/null +++ b/auto/unity_test_summary.py @@ -0,0 +1,135 @@ +#! python3 +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2015 Alexander Mueller / XelaRellum@web.de +# [Released under MIT License. Please refer to license.txt for details] +# Based on the ruby script by Mike Karlesky, Mark VanderVoord, Greg Williams +# ========================================== +import sys +import os +import re +from glob import glob + +class UnityTestSummary: + def __init__(self): + self.report = '' + self.total_tests = 0 + self.failures = 0 + self.ignored = 0 + + def run(self): + # Clean up result file names + results = [] + for target in self.targets: + results.append(target.replace('\\', '/')) + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + for result_file in results: + lines = list(map(lambda line: line.rstrip(), open(result_file, "r").read().split('\n'))) + if len(lines) == 0: + raise Exception("Empty test result file: %s" % result_file) + + details = self.get_details(result_file, lines) + failures = details['failures'] + ignores = details['ignores'] + if len(failures) > 0: failure_output.append('\n'.join(failures)) + if len(ignores) > 0: ignore_output.append('n'.join(ignores)) + tests,failures,ignored = self.parse_test_summary('\n'.join(lines)) + self.total_tests += tests + self.failures += failures + self.ignored += ignored + + if self.ignored > 0: + self.report += "\n" + self.report += "--------------------------\n" + self.report += "UNITY IGNORED TEST SUMMARY\n" + self.report += "--------------------------\n" + self.report += "\n".join(ignore_output) + + if self.failures > 0: + self.report += "\n" + self.report += "--------------------------\n" + self.report += "UNITY FAILED TEST SUMMARY\n" + self.report += "--------------------------\n" + self.report += '\n'.join(failure_output) + + self.report += "\n" + self.report += "--------------------------\n" + self.report += "OVERALL UNITY TEST SUMMARY\n" + self.report += "--------------------------\n" + self.report += "{total_tests} TOTAL TESTS {failures} TOTAL FAILURES {ignored} IGNORED\n".format(total_tests = self.total_tests, failures=self.failures, ignored=self.ignored) + self.report += "\n" + + return self.report + + def set_targets(self, target_array): + self.targets = target_array + + def set_root_path(self, path): + self.root = path + + def usage(self, err_msg=None): + print("\nERROR: ") + if err_msg: + print(err_msg) + print("\nUsage: unity_test_summary.rb result_file_directory/ root_path/") + print(" result_file_directory - The location of your results files.") + print(" Defaults to current directory if not specified.") + print(" Should end in / if specified.") + print(" root_path - Helpful for producing more verbose output if using relative paths.") + sys.exit(1) + + def get_details(self, result_file, lines): + results = { 'failures': [], 'ignores': [], 'successes': [] } + for line in lines: + parts = line.split(':') + if len(parts) != 5: + continue + src_file,src_line,test_name,status,msg = parts + if len(self.root) > 0: + line_out = "%s%s" % (self.root, line) + else: + line_out = line + if status == 'IGNORE': + results['ignores'].append(line_out) + elif status == 'FAIL': + results['failures'].append(line_out) + elif status == 'PASS': + results['successes'].append(line_out) + return results + + def parse_test_summary(self, summary): + m = re.search(r"([0-9]+) Tests ([0-9]+) Failures ([0-9]+) Ignored", summary) + if not m: + raise Exception("Couldn't parse test results: %s" % summary) + + return int(m.group(1)), int(m.group(2)), int(m.group(3)) + + +if __name__ == '__main__': + uts = UnityTestSummary() + try: + #look in the specified or current directory for result files + if len(sys.argv) > 1: + targets_dir = sys.argv[1] + else: + targets_dir = './' + targets = list(map(lambda x: x.replace('\\', '/'), glob(targets_dir + '*.test*'))) + if len(targets) == 0: + raise Exception("No *.testpass or *.testfail files found in '%s'" % targets_dir) + uts.set_targets(targets) + + #set the root path + if len(sys.argv) > 2: + root_path = sys.argv[2] + else: + root_path = os.path.split(__file__)[0] + uts.set_root_path(root_path) + + #run the summarizer + print(uts.run()) + except Exception as e: + uts.usage(e)