Browse Source

Makefile fixes and improvements

master
Apostolos Fanakis 6 years ago
parent
commit
fe34d39015
  1. 22
      Makefile
  2. 92
      test/runners/test_circ_buff_Runner.c

22
Makefile

@ -13,9 +13,10 @@ else
TARGET_EXTENSION=out TARGET_EXTENSION=out
endif endif
.PHONY: runners .PHONY: cleandep
.PHONY: clean .PHONY: clean
.PHONY: test .PHONY: test
.PHONY: runners
PATHU = unity/src/ PATHU = unity/src/
PATHS = src/ PATHS = src/
@ -29,12 +30,6 @@ PATHR = build/results/
BUILD_PATHS = $(PATHB) $(PATHD) $(PATHO) $(PATHR) $(PATHL) BUILD_PATHS = $(PATHB) $(PATHD) $(PATHO) $(PATHR) $(PATHL)
RUNNERS = $(patsubst $(PATHT)%.c,$(PATHTR)%_Runner.c, $(wildcard $(PATHT)*.c))
runners: $(RUNNERS) test
SRCTR = $(wildcard $(PATHTR)*.c)
COMPILE = gcc -c COMPILE = gcc -c
LINK = gcc LINK = gcc
DEPEND = gcc -MM -MG -MF DEPEND = gcc -MM -MG -MF
@ -55,13 +50,18 @@ CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef CFLAGS += -Wundef
CFLAGS += -Wold-style-definition CFLAGS += -Wold-style-definition
RESULTS = $(patsubst $(PATHTR)test_%_Runner.c,$(PATHR)test_%.txt,$(SRCTR)) RUNNERS = $(patsubst $(PATHT)%.c,$(PATHTR)%_Runner.c, $(wildcard $(PATHT)*.c))
runners: $(RUNNERS) test
RESULTS = $(patsubst $(PATHTR)test_%_Runner.c,$(PATHR)test_%.txt, $(RUNNERS))
DEPS = $(patsubst $(PATHT)test_%.c,$(PATHD)test_%.d, $(wildcard $(PATHT)*.c))
PASSED = `grep -s PASS $(PATHR)*.txt` PASSED = `grep -s PASS $(PATHR)*.txt`
FAIL = `grep -s FAIL $(PATHR)*.txt` FAIL = `grep -s FAIL $(PATHR)*.txt`
IGNORE = `grep -s IGNORE $(PATHR)*.txt` IGNORE = `grep -s IGNORE $(PATHR)*.txt`
test: $(BUILD_PATHS) $(RESULTS) test: $(BUILD_PATHS) $(RESULTS) $(DEPS)
@echo "===============UNIT TEST RESULTS===============\n" @echo "===============UNIT TEST RESULTS===============\n"
@echo "---------------IGNORES---------------" @echo "---------------IGNORES---------------"
@echo "$(IGNORE)" @echo "$(IGNORE)"
@ -114,6 +114,10 @@ clean:
$(CLEANUP) $(PATHO)*.o $(CLEANUP) $(PATHO)*.o
$(CLEANUP) $(PATHB)*.$(TARGET_EXTENSION) $(CLEANUP) $(PATHB)*.$(TARGET_EXTENSION)
$(CLEANUP) $(PATHR)*.txt $(CLEANUP) $(PATHR)*.txt
$(CLEANUP) $(PATHTR)*.c
cleandep:
$(CLEANUP) $(PATHD)*.d
.PRECIOUS: $(PATHB)test_%.$(TARGET_EXTENSION) .PRECIOUS: $(PATHB)test_%.$(TARGET_EXTENSION)
.PRECIOUS: $(PATHD)%.d .PRECIOUS: $(PATHD)%.d

92
test/runners/test_circ_buff_Runner.c

@ -1,92 +0,0 @@
/* AUTOGENERATED FILE. DO NOT EDIT. */
/*=======Test Runner Used To Run Each Test Below=====*/
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
UNITY_EXEC_TIME_START(); \
if (TEST_PROTECT()) \
{ \
setUp(); \
TestFunc(); \
} \
if (TEST_PROTECT()) \
{ \
tearDown(); \
} \
UNITY_EXEC_TIME_STOP(); \
UnityConcludeTest(); \
}
/*=======Automagically Detected Files To Include=====*/
#ifdef __WIN32__
#define UNITY_INCLUDE_SETUP_STUBS
#endif
#include "unity.h"
#ifndef UNITY_EXCLUDE_SETJMP_H
#include <setjmp.h>
#endif
#include <stdio.h>
#include "circ_buff.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
/*=======External Functions This Runner Calls=====*/
extern void setUp(void);
extern void tearDown(void);
extern void test_circ_buf_init(void);
extern void test_circ_buf_put(void);
extern void test_circ_buf_get(void);
extern void test_circ_buf_empty(void);
extern void test_circ_buf_full(void);
extern void test_circ_buf_capacity(void);
extern void test_circ_buf_size(void);
extern void test_circ_buf_reset(void);
/*=======Suite Setup=====*/
static void suite_setup(void)
{
#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA)
suiteSetUp();
#endif
}
/*=======Suite Teardown=====*/
static int suite_teardown(int num_failures)
{
#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA)
return suiteTearDown(num_failures);
#else
return num_failures;
#endif
}
/*=======Test Reset Option=====*/
void resetTest(void);
void resetTest(void)
{
tearDown();
setUp();
}
/*=======MAIN=====*/
int main(void)
{
suite_setup();
UnityBegin("test/test_circ_buff.c");
RUN_TEST(test_circ_buf_init, 17);
RUN_TEST(test_circ_buf_put, 29);
RUN_TEST(test_circ_buf_get, 73);
RUN_TEST(test_circ_buf_empty, 110);
RUN_TEST(test_circ_buf_full, 142);
RUN_TEST(test_circ_buf_capacity, 164);
RUN_TEST(test_circ_buf_size, 191);
RUN_TEST(test_circ_buf_reset, 220);
return suite_teardown(UnityEnd());
}
Loading…
Cancel
Save