Hi everyone, I''m attempting to build a Symfony app and run the included tests: project.build_command = ''./symfony propel-build-all-load my_project; ./symfony test-all'' The issue with this is that both commands return success even if there''s a build error or a failing test. I figured I could just grab the results, grep for "Failed" and exit 1 on failure, 0 on success. This works, but doesn''t print any output to the Build Log. If I print the captured output, it prints twice in the build log. Any advice on how to proceed? Am I barking up the wrong tree? Should I turn this into a proper rake task? Thanks, Sean
Hi, There is no reason why you should do it via Rake. project.build_command is invoked with " > $CC_BUILD_ARTIFACTS/build.log" appended to the end of it. A big part of your problem must be that you have two commands in there, so the output of one is not redirected to build.log. So, the way around this is probably to enclose it all in parentheses: ''(./symfony propel-build-all-load my_project ./symfony test-all)'' or if that doesn''t work, put this sequence into a shell script and invoke the shell script As for parsing the build.log to decide the build outcome, I would just try to parse it from $CC_BUILD_ARTEFACTS/build.log. Of course, that means that you are parsing the file you are at the same time writing, so there may be some interesting hiccups there. Best regards, Alex "Sean Hussey" <seanhussey at gmail.com> Sent by: cruisecontrolrb-users-bounces at rubyforge.org 03/21/2007 10:11 AM To Cruisecontrolrb-users at rubyforge.org cc Subject [Cruisecontrolrb-users] Building non-Rails apps Hi everyone, I''m attempting to build a Symfony app and run the included tests: project.build_command = ''./symfony propel-build-all-load my_project; ./symfony test-all'' The issue with this is that both commands return success even if there''s a build error or a failing test. I figured I could just grab the results, grep for "Failed" and exit 1 on failure, 0 on success. This works, but doesn''t print any output to the Build Log. If I print the captured output, it prints twice in the build log. Any advice on how to proceed? Am I barking up the wrong tree? Should I turn this into a proper rake task? Thanks, Sean _______________________________________________ Cruisecontrolrb-users mailing list Cruisecontrolrb-users at rubyforge.org http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20070321/b3883d63/attachment.html
Ok, I''m getting onto the right track now. I''m calling one shell script that calls each of the two commands in succession. Now get all of the output in the Build Log. But now I''m back to the tests failing, but returning status 0. CC thinks this is a success, and so the build "succeeds" even with failing tests. I know this is an issue with how Symfony runs tests, so I''m trying this (simplified) instead: #!/usr/bin/env ruby result =`./symfony test-all` if /Failed/ =~ result then exit(1) else exit(0) end Now the build fails, but there''s no output. What can I return from this script to have it end up in the log? Or is there where I should try to parse the log file as it''s being created? Thanks! Sean On 3/21/07, Alexey Verkhovsky <averkhov at thoughtworks.com> wrote:> > Hi, > > There is no reason why you should do it via Rake. > > project.build_command is invoked with " > $CC_BUILD_ARTIFACTS/build.log" > appended to the end of it. > A big part of your problem must be that you have two commands in there, so > the output of one is not redirected to build.log. So, the way around this is > probably to enclose it all in parentheses: > > ''(./symfony propel-build-all-load my_project ./symfony test-all)'' > > or if that doesn''t work, put this sequence into a shell script and invoke > the shell script > > As for parsing the build.log to decide the build outcome, I would just try > to parse it from $CC_BUILD_ARTEFACTS/build.log. Of course, that means that > you are parsing the file you are at the same time writing, so there may be > some interesting hiccups there. > > Best regards, > Alex > > > > > > > "Sean Hussey" <seanhussey at gmail.com> > Sent by: cruisecontrolrb-users-bounces at rubyforge.org > > 03/21/2007 10:11 AM > > To Cruisecontrolrb-users at rubyforge.org > > cc > > Subject [Cruisecontrolrb-users] Building non-Rails apps > > > > > > Hi everyone, > > I''m attempting to build a Symfony app and run the included tests: > > project.build_command = ''./symfony propel-build-all-load my_project; > ./symfony test-all'' > > The issue with this is that both commands return success even if > there''s a build error or a failing test. > > I figured I could just grab the results, grep for "Failed" and exit 1 > on failure, 0 on success. This works, but doesn''t print any output to > the Build Log. If I print the captured output, it prints twice in the > build log. > > Any advice on how to proceed? Am I barking up the wrong tree? Should > I turn this into a proper rake task? > > Thanks, > > Sean > _______________________________________________ > Cruisecontrolrb-users mailing list > Cruisecontrolrb-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit > http://www.messagelabs.com/email > ______________________________________________________________________ > > > _______________________________________________ > Cruisecontrolrb-users mailing list > Cruisecontrolrb-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users > >
On 27/03/2007, at 4:09 AM, Sean Hussey wrote:> #!/usr/bin/env ruby > > result =`./symfony test-all` > if /Failed/ =~ result then > exit(1) > else > exit(0) > end > > Now the build fails, but there''s no output. What can I return from > this script to have it end up in the log? Or is there where I should > try to parse the log file as it''s being created?try: #!/usr/bin/env ruby $stdout.write result = IO.popen("./symfony test-all 2>&1").read exit(1) if result.include?("Failed") -- tim
This did it. Thank you! On 3/26/07, Tim Lucas <t.lucas at toolmantim.com> wrote:> On 27/03/2007, at 4:09 AM, Sean Hussey wrote: > > > #!/usr/bin/env ruby > > > > result =`./symfony test-all` > > if /Failed/ =~ result then > > exit(1) > > else > > exit(0) > > end > > > > Now the build fails, but there''s no output. What can I return from > > this script to have it end up in the log? Or is there where I should > > try to parse the log file as it''s being created? > > try: > > #!/usr/bin/env ruby > $stdout.write result = IO.popen("./symfony test-all 2>&1").read > exit(1) if result.include?("Failed") > > -- tim >