2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 13:22:11 +00:00

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.



[SVN r78847]
This commit is contained in:
K. Noel Belcourt
2012-06-07 15:36:46 +00:00
parent 40dcb724bf
commit 30130783cb
3 changed files with 32 additions and 10 deletions

View File

@@ -88,6 +88,7 @@ static struct
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 @@ int read_descriptor( int i, int s )
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 @@ int exec_wait()
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;

View File

@@ -152,7 +152,8 @@ struct globs globs =
{ 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 @@ int main( int argc, char * * argv, char * * arg_environ )
--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 @@ int main( int argc, char * * argv, char * * arg_environ )
/* 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 @@ int main( int argc, char * * argv, char * * arg_environ )
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 )
{

View File

@@ -456,6 +456,7 @@ struct globs
* 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;