1
1

Ensure that output ends on an appropriate suffix tag when --tag-output or --xml are selected.

When we read the input buffer, we don't always get a complete printf output - we sometimes end mid stream. We still need to add the suffix and a <CR> to keep the output working right.

This commit was SVN r21706.
Этот коммит содержится в:
Ralph Castain 2009-07-17 05:02:53 +00:00
родитель 4c1eb040b0
Коммит ef20e778b3
3 изменённых файлов: 37 добавлений и 2 удалений

Просмотреть файл

@ -53,6 +53,7 @@ int orte_iof_base_write_output(orte_process_name_t *name, orte_iof_tag_t stream,
char starttag[ORTE_IOF_BASE_TAG_MAX], endtag[ORTE_IOF_BASE_TAG_MAX], *suffix;
orte_iof_write_output_t *output;
int i, j, k, starttaglen, endtaglen, num_buffered;
bool endtagged;
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
"%s write:output setting up to write %d bytes to %s for %s on fd %d",
@ -149,6 +150,7 @@ int orte_iof_base_write_output(orte_process_name_t *name, orte_iof_tag_t stream,
construct:
starttaglen = strlen(starttag);
endtaglen = strlen(endtag);
endtagged = false;
/* start with the tag */
for (j=0, k=0; j < starttaglen && k < ORTE_IOF_BASE_TAGGED_OUT_MAX; j++) {
output->data[k++] = starttag[j];
@ -159,7 +161,7 @@ construct:
for (i=0; i < numbytes && k < ORTE_IOF_BASE_TAGGED_OUT_MAX; i++) {
if ('\n' == data[i]) {
/* we need to break the line with the end tag */
for (j=0; j < endtaglen && k < ORTE_IOF_BASE_TAGGED_OUT_MAX; j++) {
for (j=0; j < endtaglen && k < ORTE_IOF_BASE_TAGGED_OUT_MAX-1; j++) {
output->data[k++] = endtag[j];
}
/* move the <cr> over */
@ -168,7 +170,10 @@ construct:
if (i < numbytes-1) {
for (j=0; j < starttaglen && k < ORTE_IOF_BASE_TAGGED_OUT_MAX; j++) {
output->data[k++] = starttag[j];
endtagged = false;
}
} else {
endtagged = true;
}
} else if (orte_xml_output) {
if ('&' == data[i]) {
@ -206,6 +211,13 @@ construct:
output->data[k++] = data[i];
}
}
if (!endtagged) {
/* need to add an endtag */
for (j=0; j < endtaglen && k < ORTE_IOF_BASE_TAGGED_OUT_MAX-1; j++) {
output->data[k++] = endtag[j];
}
output->data[k++] = '\n';
}
output->numbytes = k;
process:

Просмотреть файл

@ -1,4 +1,4 @@
PROGS = mpi_no_op mpi_barrier hello hello_nodename abort multi_abort simple_spawn concurrent_spawn spawn_multiple mpi_spin delayed_abort loop_spawn loop_child bad_exit pubsub hello_barrier segv accept connect hello_output hello_show_help crisscross read_write ziatest slave_spawn slave cell_spawn reduce-hang ziaprobe ziatest bcast_loop parallel_w8 parallel_w64 parallel_r8 parallel_r64
PROGS = mpi_no_op mpi_barrier hello hello_nodename abort multi_abort simple_spawn concurrent_spawn spawn_multiple mpi_spin delayed_abort loop_spawn loop_child bad_exit pubsub hello_barrier segv accept connect hello_output hello_show_help crisscross read_write ziatest slave_spawn slave cell_spawn reduce-hang ziaprobe ziatest bcast_loop parallel_w8 parallel_w64 parallel_r8 parallel_r64 sio
all: $(PROGS)

23
orte/test/mpi/sio.c Обычный файл
Просмотреть файл

@ -0,0 +1,23 @@
/* -*- C -*-
*
* $HEADER$
*
* The most basic of MPI applications
*/
#include <stdio.h>
#include "mpi.h"
int main(int argc, char* argv[])
{
int i;
MPI_Init(&argc, &argv);
for (i=0; i < 100; i++) {
printf("some output from mpitest to test the xml problem: %d\n", i);
}
MPI_Finalize();
return 0;
}