xbt_str_trim(filename, NULL);
OUT = fopen(filename, "w");
if (!OUT) {
- THROW3(system_error, errno, "%s: Cannot create file %s: %s",
+ THROWF(system_error, errno, "%s: Cannot create file %s: %s",
rctx->filepos, filename, strerror(errno));
}
err = (fprintf(OUT, "%s", rctx->input->data) < 0);
err = (fclose(OUT) == -1) || err;
if (err) {
- THROW3(system_error, errno, "%s: Cannot write file %s: %s",
+ THROWF(system_error, errno, "%s: Cannot write file %s: %s",
rctx->filepos, filename, strerror(errno));
}
free(filename);
rctx_dump(rctx, "wait");
if (!rctx->is_stoppable)
- THROW1(unknown_error, 0, "Cmd '%s' not started yet. Cannot wait it",
+ THROWF(unknown_error, 0, "Cmd '%s' not started yet. Cannot wait it",
rctx->cmd);
/* Wait for the child to die or the timeout to happen (or an armageddon to happen) */
errcode = 1;
}
- if (rctx->output_sort) {
- xbt_dynar_t a = xbt_str_split(rctx->output_got->data, "\n");
- xbt_dynar_sort(a,cmpstringp);
- char *sorted_output = xbt_str_join(a, "\n");
- strcpy(rctx->output_got->data, sorted_output);
- xbt_free(sorted_output);
- xbt_dynar_free(&a);
- /* If an empty line moved in first position, move it back to the end */
- if (rctx->output_got->data[0]=='\n') {
- memmove(rctx->output_got->data,rctx->output_got->data+1,rctx->output_got->used-1);
- rctx->output_got->data[rctx->output_got->used-1] = '\n';
- }
- }
+ if(rctx->output_sort || coverage){
+ xbt_dynar_t a = xbt_str_split(rctx->output_got->data, "\n");
+
+ if (rctx->output_sort)
+ xbt_dynar_sort(a,cmpstringp);
+
+ if (coverage){
+ int pos;
+ char* data;
+ for(pos=0;pos<xbt_dynar_length(a);pos++){
+ data = xbt_dynar_get_as(a,pos,char*);
+ if(!strncmp(data,"profiling:",strlen("profiling:"))){
+ XBT_INFO("Remove line a[%d]='%s'",pos,data);
+ rctx->output_got->used -= strlen(data)+1;
+ xbt_dynar_remove_at(a,pos,data);
+ }
+
+ }
+ }
+
+ char *sorted_output = xbt_str_join(a, "\n");
+ strcpy(rctx->output_got->data, sorted_output);
+ xbt_free(sorted_output);
+ xbt_dynar_free(&a);
+
+ /* If an empty line moved in first position, move it back to the end */
+ if (rctx->output_got->data[0]=='\n') {
+ memmove(rctx->output_got->data,rctx->output_got->data+1,rctx->output_got->used-1);
+ rctx->output_got->data[rctx->output_got->used-1] = '\n';
+ }
+ }
+
if ((errcode && errcode != 1) || rctx->interrupted) {
/* checking output, and matching */
xbt_dynar_t a = xbt_str_split(rctx->output_got->data, "\n");