diff options
author | rodrigosiqueira <rodrigosiqueiramelo@gmail.com> | 2016-12-04 11:28:25 -0200 |
---|---|---|
committer | rodrigosiqueira <rodrigosiqueiramelo@gmail.com> | 2016-12-04 11:34:27 -0200 |
commit | e0152319f5ed6d99eb38bf6da40157a60fd48e04 (patch) | |
tree | 7441f203a9564ae4073297d2215b5bf35d7303d5 /tests/unit/Makefile | |
parent | a44cc7a3d1c21c37c7dfb88b92bb479389dfce16 (diff) | |
download | yosys-e0152319f5ed6d99eb38bf6da40157a60fd48e04.tar.gz yosys-e0152319f5ed6d99eb38bf6da40157a60fd48e04.tar.bz2 yosys-e0152319f5ed6d99eb38bf6da40157a60fd48e04.zip |
Added required structure to implement unit tests
Added modifications inside the main Makefile to refers the unit test Makefile.
Added separated Makefile only for compiling unit tests.
Added simple example of unit test.
Signed-off-by: Charles Oliveira <18oliveira.charles@gmail.com>
Signed-off-by: Pablo Alejandro <pabloabur@usp.br>
Signed-off-by: Rodrigo Siqueira <siqueira@ime.usp.br>
Diffstat (limited to 'tests/unit/Makefile')
-rw-r--r-- | tests/unit/Makefile | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit/Makefile b/tests/unit/Makefile new file mode 100644 index 000000000..16f65ec20 --- /dev/null +++ b/tests/unit/Makefile @@ -0,0 +1,28 @@ +GTESTFLAG := -lgtest -lgtest_main +RPATH := -Wl,-rpath +EXTRAFLAGS := -lyosys + +ALLTESTFILE := $(wildcard ./**/*Test.cc) +OBJTEST := objtest +BINTEST := bintest + +all: prepare $(ALLTESTFILE:%Test.cc=%Test.o) + +%Test.o: %Test.cc + $(CXX) -o $(OBJTEST)/$(notdir $@) -c -I$(ROOTPATH) $(CPPFLAGS) $(CXXFLAGS) $< + $(CXX) -L$(ROOTPATH) $(RPATH)=$(ROOTPATH) -o \ + $(BINTEST)/$(basename $(notdir $@)) $(OBJTEST)/$(notdir $@) $(LDLIBS) \ + $(GTESTFLAG) $(EXTRAFLAGS) + +.PHONY: prepare run-tests clean + +run-tests: + $(CURDIR)/$(BINTEST)/* + +prepare: + mkdir -p $(OBJTEST) + mkdir -p $(BINTEST) + +clean: + rm -rf $(OBJTEST) + rm -rf $(BINTEST) |