|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78847 - trunk/tools/build/v2/engine
From: kbelco_at_[hidden]
Date: 2012-06-07 11:36:46
Author: noel_belcourt
Date: 2012-06-07 11:36:46 EDT (Thu, 07 Jun 2012)
New Revision: 78847
URL: http://svn.boost.org/trac/boost/changeset/78847
Log:
Add ability to limit amount of target output that is
output by bjam. Added bjam argument -mx where x is
the maximum amount of output to be captured from a
target, in kb.
This fix will enable, PGI, VACPP, and Clang to cycle
normally in the nightly testing.
Text files modified:
trunk/tools/build/v2/engine/execunix.c | 32 ++++++++++++++++++++++++--------
trunk/tools/build/v2/engine/jam.c | 9 +++++++--
trunk/tools/build/v2/engine/jam.h | 1 +
3 files changed, 32 insertions(+), 10 deletions(-)
Modified: trunk/tools/build/v2/engine/execunix.c
==============================================================================
--- trunk/tools/build/v2/engine/execunix.c (original)
+++ trunk/tools/build/v2/engine/execunix.c 2012-06-07 11:36:46 EDT (Thu, 07 Jun 2012)
@@ -88,6 +88,7 @@
char *target; /* buffer to hold action and target invoked */
char *command; /* buffer to hold command being invoked */
char *buffer[2]; /* buffer to hold stdout and stderr, if any */
+ int buf_size[2]; /* size of buffer (bytes) */
void (*func)( void *closure, int status, timing_info*, const char *, const char * );
void *closure;
time_t start_dt; /* start of command timestamp */
@@ -353,18 +354,31 @@
if ( !cmdtab[ i ].buffer[ s ] )
{
/* Never been allocated. */
- cmdtab[ i ].buffer[ s ] = (char*)BJAM_MALLOC_ATOMIC( ret + 1 );
- memcpy( cmdtab[ i ].buffer[ s ], buffer, ret + 1 );
+ if (ret <= globs.max_buf || 0 == globs.max_buf) {
+ cmdtab[ i ].buf_size[ s ] = ret + 1;
+ cmdtab[ i ].buffer[ s ] = (char*)BJAM_MALLOC_ATOMIC( ret + 1 );
+ memcpy( cmdtab[ i ].buffer[ s ], buffer, ret + 1 );
+ }
+ else {
+ ret = globs.max_buf;
+ buffer[ret] = 0;
+ cmdtab[ i ].buf_size[ s ] = ret + 1;
+ cmdtab[ i ].buffer[ s ] = (char*)BJAM_MALLOC_ATOMIC( ret + 1 );
+ memcpy( cmdtab[ i ].buffer[ s ], buffer, ret + 1);
+ }
}
else
{
/* Previously allocated. */
- char * tmp = cmdtab[ i ].buffer[ s ];
- len = strlen( tmp );
- cmdtab[ i ].buffer[ s ] = (char*)BJAM_MALLOC_ATOMIC( len + ret + 1 );
- memcpy( cmdtab[ i ].buffer[ s ], tmp, len );
- memcpy( cmdtab[ i ].buffer[ s ] + len, buffer, ret + 1 );
- BJAM_FREE( tmp );
+ if (cmdtab[ i ].buf_size[ s ] < globs.max_buf || 0 == globs.max_buf) {
+ char * tmp = cmdtab[ i ].buffer[ s ];
+ len = cmdtab[ i ].buf_size[ s ];
+ cmdtab[ i ].buf_size[ s ] = len + ret + 1;
+ cmdtab[ i ].buffer[ s ] = (char*)BJAM_MALLOC_ATOMIC( len + ret + 1 );
+ memcpy( cmdtab[ i ].buffer[ s ], tmp, len );
+ memcpy( cmdtab[ i ].buffer[ s ] + len, buffer, ret + 1 );
+ BJAM_FREE( tmp );
+ }
}
}
@@ -543,9 +557,11 @@
BJAM_FREE( cmdtab[ i ].buffer[ OUT ] );
cmdtab[ i ].buffer[ OUT ] = 0;
+ cmdtab[ i ].buf_size[ OUT ] = 0;
BJAM_FREE( cmdtab[ i ].buffer[ ERR ] );
cmdtab[ i ].buffer[ ERR ] = 0;
+ cmdtab[ i ].buf_size[ ERR ] = 0;
BJAM_FREE( cmdtab[ i ].command );
cmdtab[ i ].command = 0;
Modified: trunk/tools/build/v2/engine/jam.c
==============================================================================
--- trunk/tools/build/v2/engine/jam.c (original)
+++ trunk/tools/build/v2/engine/jam.c 2012-06-07 11:36:46 EDT (Thu, 07 Jun 2012)
@@ -152,7 +152,8 @@
{ 0, 1 }, /* debug ... */
#endif
0, /* output commands, not run them */
- 0 /* action timeout */
+ 0, /* action timeout */
+ 0 /* maximum buffer size zero is all output */
};
/* Symbols to be defined as true for use in Jambase. */
@@ -241,7 +242,7 @@
--argc;
++argv;
- if ( getoptions( argc, argv, "-:l:d:j:p:f:gs:t:ano:qv", optv ) < 0 )
+ if ( getoptions( argc, argv, "-:l:m:d:j:p:f:gs:t:ano:qv", optv ) < 0 )
{
printf( "\nusage: %s [ options ] targets...\n\n", progname );
@@ -251,6 +252,7 @@
/* printf( "-g Build from newest sources first.\n" ); */
printf( "-jx Run up to x shell commands concurrently.\n" );
printf( "-lx Limit actions to x number of seconds after which they are stopped.\n" );
+ printf( "-mx Maximum target output saved (kb), default is to save all output.\n" );
printf( "-n Don't actually execute the updating actions.\n" );
printf( "-ox Write the updating actions to file x.\n" );
printf( "-px x=0, pipes action stdout and stderr merged into action output.\n" );
@@ -318,6 +320,9 @@
if ( ( s = getoptval( optv, 'l', 0 ) ) )
globs.timeout = atoi( s );
+ if ( ( s = getoptval( optv, 'm', 0 ) ) )
+ globs.max_buf = atoi( s ) * 1024; /* convert to kb */
+
/* Turn on/off debugging */
for ( n = 0; ( s = getoptval( optv, 'd', n ) ); ++n )
{
Modified: trunk/tools/build/v2/engine/jam.h
==============================================================================
--- trunk/tools/build/v2/engine/jam.h (original)
+++ trunk/tools/build/v2/engine/jam.h 2012-06-07 11:36:46 EDT (Thu, 07 Jun 2012)
@@ -456,6 +456,7 @@
* default 0 for no limit.
*/
int dart; /* output build and test results formatted for Dart */
+ int max_buf; /* maximum amount of output saved from target (kb) */
};
extern struct globs globs;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk