1
0
mirror of https://github.com/meekrosoft/fff synced 2026-01-23 00:15:59 +01:00

Add googletest library and update makefiles

This commit is contained in:
Mike Long
2012-04-21 07:45:37 +01:00
parent 329b83f15a
commit 3c8beeaa58
12 changed files with 31280 additions and 15 deletions

View File

@@ -1,8 +1,10 @@
all:
mkdir -p build
cd gtest; make all
cd test; make all
cd examples; make all
clean:
cd gtest; make clean
cd test; make clean
cd examples; make clean

View File

@@ -1,3 +1,3 @@
#!/bin/sh
ruby fakegen.rb > fff.h && make clean && make all && build/fff_test_c && build/fff_test_cpp
ruby fakegen.rb > fff3.h && make clean && make all && build/fff_test_c && build/fff_test_cpp

View File

@@ -10,10 +10,11 @@ CPP = g++
CPP += -c
LD = g++
GTEST_OBJS = $(BUILD_DIR)/gtest-all.o $(BUILD_DIR)/gtest-main.o
C_OBJFILES = $(BUILD_DIR)/UI_test_ansic.o $(BUILD_DIR)/UI.o
TEMPLATE_OBJFILES = $(BUILD_DIR)/test_suite_template.o
CPP_OBJFILES = $(BUILD_DIR)/UI_test_cpp.o $(BUILD_DIR)/UI.o
CPP_LIBS = -lgtest -lpthread -lgtest_main
CPP_OBJFILES = $(BUILD_DIR)/UI_test_cpp.o $(BUILD_DIR)/UI.o $(GTEST_OBJS)
CPP_LIBS = -lpthread
all: $(C_PROGNAME) $(CPP_PROGNAME) $(TEMPLATE_PROGNAME)
@@ -42,7 +43,7 @@ $(BUILD_DIR)/%.o: %.c
$(BUILD_DIR)/%.o: %.cpp
@echo "Compiling "$@
@echo " CPP "$<
$(CPP) -I/home/mlong/tools/gtest/gtest-1.5.0/include -o $@ $<
$(CPP) -I.. -o $@ $<
$(TEMPLATE_PROGNAME): $(TEMPLATE_OBJFILES)
@echo "Linking "$@
@@ -57,7 +58,7 @@ $(C_PROGNAME): $(C_OBJFILES)
$(CPP_PROGNAME): $(CPP_OBJFILES) $(C_OBJFILES)
@echo "Linking "$@
@echo " LD -o "$(CPP_PROGNAME)" "$(CPP_OBJFILES)
$(LD) -L/home/mlong/tools/gtest -o $(CPP_PROGNAME) $(CPP_OBJFILES) $(CPP_LIBS)
$(LD) -o $(CPP_PROGNAME) $(CPP_OBJFILES) $(CPP_LIBS)

View File

@@ -276,7 +276,8 @@ def output_c_and_cpp
include_guard {
output_constants
define_reset_fake
puts "#ifdef __cplusplus"
$cpp_output = true
yield
@@ -293,7 +294,6 @@ end
# lets generate!!
output_c_and_cpp{
define_reset_fake
define_call_history
define_return_sequence
output_cpp_reset_code if $cpp_output

2577
fff3.h Normal file

File diff suppressed because it is too large Load Diff

22
gtest/Makefile Normal file
View File

@@ -0,0 +1,22 @@
BUILD_DIR = ../build
LIBS := -lpthread
CPP_OBJS=$(BUILD_DIR)/gtest-all.o $(BUILD_DIR)/gtest-main.o
SOURCES=gtest-all.cc gtest-main.cc
# Each subdirectory must supply rules for building sources it contributes
$(BUILD_DIR)/%.o: %.cc
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
g++ -I../ -O0 -g3 -Wall -c -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
all: $(CPP_OBJS)
clean:
-$(RM) $(CPP_OBJS)
-@echo ' '

9118
gtest/gtest-all.cc Normal file

File diff suppressed because it is too large Load Diff

6
gtest/gtest-main.cc Normal file
View File

@@ -0,0 +1,6 @@
#include "gtest.h"
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

19537
gtest/gtest.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,12 +2,14 @@
BUILD_DIR = ../build
CPP_OBJS += \
$(BUILD_DIR)/fff_test_cpp.o
$(BUILD_DIR)/fff_test_cpp.o \
$(BUILD_DIR)/gtest-all.o \
$(BUILD_DIR)/gtest-main.o
C_OBJS += \
$(BUILD_DIR)/fff_test_c.o
LIBS := -lgtest_main -lgtest -lpthread
LIBS := -lpthread
CPPNAME = $(BUILD_DIR)/fff_test_cpp
CNAME = $(BUILD_DIR)/fff_test_c
@@ -19,14 +21,14 @@ all: $(CPPNAME) $(CNAME)
$(BUILD_DIR)/%.o: %.cpp
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
g++ -I/home/mlong/tools/gtest/gtest-1.5.0/include -O0 -g3 -Wall -c -o"$@" "$<"
g++ -I../ -O0 -g3 -Wall -c -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
$(BUILD_DIR)/%.o: %.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
gcc -I/home/mlong/tools/gtest/gtest-1.5.0/include -O0 -g3 -Wall -std=c99 -c -o"$@" "$<"
gcc -I../ -O0 -g3 -Wall -std=c99 -c -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
@@ -35,14 +37,14 @@ $(BUILD_DIR)/%.o: %.c
$(CPPNAME): $(CPP_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -L/home/mlong/tools/gtest -o"$(CPPNAME)" $(CPP_OBJS) $(LIBS)
g++ -o "$(CPPNAME)" $(CPP_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
$(CNAME): $(C_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -L/home/mlong/tools/gtest -o"$(CNAME)" $(C_OBJS) $(LIBS)
g++ -o "$(CNAME)" $(C_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '

View File

@@ -6,7 +6,7 @@
#define OVERRIDE_CALL_HIST_LEN 17u
#define FFF_CALL_HISTORY_LEN OVERRIDE_CALL_HIST_LEN
#include "../fff.h"
#include "../fff3.h"
#include <assert.h>
#include <stdio.h>

View File

@@ -12,7 +12,7 @@
#define OVERRIDE_CALL_HIST_LEN 17u
#define FFF_CALL_HISTORY_LEN OVERRIDE_CALL_HIST_LEN
#include "../fff.h"
#include "../fff3.h"
#include <gtest/gtest.h>
FAKE_VOID_FUNC(voidfunc1, int);