From 084aa631725ffec9f99bc09fd095f3772fdaceac Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 14 Nov 2014 10:57:29 -0500 Subject: [PATCH] dsf-gdb tests: Improve tests Makefile This changes the Makefile that builds test apps so that it uses the proper Makefile structures, rather than a single shell command. Also, this will compile .c files with gcc and .cc files with g++, allowing to have both. Also, I changed the .exe extension justification from "so that CVS does not include it when making a patch" to "so that files are named the same way in Linux and Windows". It seems more reasonable. Change-Id: I4414b1dc5c31a9eaa7edaed30e53363b9a76dd8f Signed-off-by: Simon Marchi Reviewed-on: https://git.eclipse.org/r/36488 Tested-by: Marc-Andre Laperle Tested-by: Hudson CI Reviewed-by: Marc Khouzam Tested-by: Marc Khouzam --- .../data/launch/src/Makefile | 53 +++++++++++++------ .../data/launch/src/MultiThreadRunControl.cc | 2 +- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile index e67f6e886e9..a54528f6acd 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile @@ -1,17 +1,38 @@ -src = $(wildcard *.cc *.c) -destDir = ../bin -GCCFLAGS = -gdwarf-2 -pthread +BINDIR = ../bin +SRC_C = $(wildcard *.c) +SRC_CXX = $(wildcard *.cc) -all: - @mkdir -p $(destDir) -# Name the target with an .exe extension so that CVS does not -# include it when making a patch - @for file in $(src) ; \ - do \ - target=`basename $$file .c` ; \ - target=`basename $$target .cc` ; \ - g++ $(GCCFLAGS) $$file -o $(destDir)/$$target.exe ; \ - done -# Now generate the core file that we need for the post-mortem core-file tests - @gdb --nx --batch -ex "b testLocals" -ex run -ex "next 16" -ex "gcore ../bin/core" \ - ../bin/ExpressionTestApp.exe > /dev/null +# Use .exe extension so that files are named the same way in Linux and Windows. +BINS = $(patsubst %.c,$(BINDIR)/%.exe,$(SRC_C)) $(patsubst %.cc,$(BINDIR)/%.exe,$(SRC_CXX)) +COREFILE = $(BINDIR)/core + +CC = gcc +CFLAGS = -gdwarf-2 -pthread + +CXX = g++ +CXXFLAGS = -gdwarf-2 -pthread + +MKDIR = mkdir -p +RM = rm -f +RMDIR = rmdir + +.PHONY: all clean + +all: $(BINS) $(COREFILE) + +$(BINDIR): + $(MKDIR) $@ + +$(BINDIR)/%.exe: %.c | $(BINDIR) + $(CC) $(CFLAGS) -o $@ $< + +$(BINDIR)/%.exe: %.cc | $(BINDIR) + $(CXX) $(CXXFLAGS) -o $@ $< + +# Generate a core file that is needed for post-morted core-file tests +$(COREFILE): $(BINDIR)/ExpressionTestApp.exe | $(BINDIR) + gdb -nx --batch -ex 'b testLocals' -ex 'run' --ex 'next 16' \ + -ex 'gcore ../bin/core' $(BINDIR)/ExpressionTestApp.exe > /dev/null + +clean: + $(RM) -r $(BINDIR) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc index 4556b07b6dd..30b23e74b2d 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc @@ -21,7 +21,7 @@ void firstBreakpoint(long id) #ifdef __MINGW32__ -unsigned int __stdcall PrintHello(void *threadid) +unsigned int __stdcall PrintHello(void *threadId) #else void *PrintHello(void *threadId) #endif