[cmake-developers] [PATCH] Tell CTest about Apache Maven warnings

2011-03-18 Thread Rolf Eike Beer
Hi,

we had a lot of fun debugging our nightly builds in the last couple of days. 
Part of our build process are some programs that get build using Apache Maven 
and are used to generate other files later on. It's something like this:

ADD_CUSTOM_COMMAND(
OUTPUT ${artifact}
DEPENDS ${sources}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${MAVEN_EXECUTABLE} --quiet install
COMMENT Building Java artifacts using Apache Maven...
VERBATIM
)
ADD_CUSTOM_TARGET(${target} ALL DEPENDS ${artifact})

And then some other ADD_CUSTOM_COMMANDS that depend on ${target}. When this 
was run on any of our desktops it worked fine, when we log in to the build 
machines it works fine, but when it runs with cron it doesn't work (not even 
on the Windows hosts). Since the first errors we got in CDash log were those 
of the target files that could not be generated because the maven output was 
missing we suspected some sort of dependency problem. It took us a while to 
find out that the dependencies were fine and Maven really wrote out some 
errors but CTest just didn't catch them. At the end it was just JAVA_HOME 
environment not being set when running with cron (easily fixed by source 
/etc/profile in the nightly script).

To prevent other people wasting their time hunting bugs that are simply not 
there: here is a small patch that tells CTest to detect Mavens error and 
warning messages.

Eike
From 36fdcaf33df5435a3f351158c8e1a3040518d210 Mon Sep 17 00:00:00 2001
From: Rolf Eike Beer e...@sf-mail.de
Date: Fri, 18 Mar 2011 09:38:34 +0100
Subject: [PATCH] CTest: catch warning output of Apache Maven

Some samples of things that got unnoticed by our nightly builds:

$ JAVA_HOME= mvn
Warning: JAVA_HOME environment variable is not set.
...

$ mvn
[INFO] Scanning for projects...
[INFO] 
[ERROR] BUILD FAILURE
...
---
 Source/CTest/cmCTestBuildHandler.cxx |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 9678ac4..86bd85d 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -93,6 +93,7 @@ static const char* cmCTestErrorMatches[] = {
   : No such file or directory,
   : Invalid argument,
   ^The project cannot be built\\.,
+  ^\\[ERROR\\],
   0
 };
 
@@ -119,7 +120,7 @@ static const char* cmCTestWarningMatches[] = {
   ^\[^\]+\, line [0-9]+: [Ww](arning|arnung),
   ([^:]+): warning[ \\t]*[0-9]+[ \\t]*:,
   ^(Warning|Warnung) ([0-9]+):,
-  ^(Warning|Warnung) ,
+  ^(Warning|Warnung)[ :],
   WARNING: ,
   ([^ :]+) : warning,
   ([^:]+): warning,
@@ -131,6 +132,7 @@ static const char* cmCTestWarningMatches[] = {
   \.*\, line [0-9]+: remark\\([0-9]*\\):,
   cc-[0-9]* CC: REMARK File = .*, Line = [0-9]*,
   ^CMake Warning.*:,
+  ^\\[WARNING\\],
   0
 };
 
-- 
1.7.3.4

___
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] Tell CTest about Apache Maven warnings

2011-03-18 Thread David Cole
Thanks. Looks reasonable. Merged/pushed to next:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fcf3208ac10942344d4e7302ca8351758ba26978

Expect it in the next release.

thx,
David


On Fri, Mar 18, 2011 at 4:51 AM, Rolf Eike Beer e...@sf-mail.de wrote:
 Hi,

 we had a lot of fun debugging our nightly builds in the last couple of days.
 Part of our build process are some programs that get build using Apache Maven
 and are used to generate other files later on. It's something like this:

 ADD_CUSTOM_COMMAND(
        OUTPUT ${artifact}
        DEPENDS ${sources}
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        COMMAND ${MAVEN_EXECUTABLE} --quiet install
        COMMENT Building Java artifacts using Apache Maven...
        VERBATIM
 )
 ADD_CUSTOM_TARGET(${target} ALL DEPENDS ${artifact})

 And then some other ADD_CUSTOM_COMMANDS that depend on ${target}. When this
 was run on any of our desktops it worked fine, when we log in to the build
 machines it works fine, but when it runs with cron it doesn't work (not even
 on the Windows hosts). Since the first errors we got in CDash log were those
 of the target files that could not be generated because the maven output was
 missing we suspected some sort of dependency problem. It took us a while to
 find out that the dependencies were fine and Maven really wrote out some
 errors but CTest just didn't catch them. At the end it was just JAVA_HOME
 environment not being set when running with cron (easily fixed by source
 /etc/profile in the nightly script).

 To prevent other people wasting their time hunting bugs that are simply not
 there: here is a small patch that tells CTest to detect Mavens error and
 warning messages.

 Eike

 ___
 cmake-developers mailing list
 cmake-developers@cmake.org
 http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


___
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers