Index: tests/meta/fork+exec.cfa
===================================================================
--- tests/meta/fork+exec.cfa	(revision a659b31f9366d9a17ae8f8dbdc7a64ba5e1a646a)
+++ tests/meta/fork+exec.cfa	(revision a25bcf8ab29dde92e982540e533dcee4c347fd63)
@@ -13,21 +13,9 @@
 // Update Count     :
 //
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 
-#include <errno.h>
-#include <signal.h>
-
-extern "C" {
-	#include <sys/types.h>
-	#include <sys/wait.h>
-	#include <unistd.h>
-}
-
-int true_main(const char * exec);
+#include "fork+exec.hfa"
 
 int main(int argc, char * argv[]) {
-	if(!getenv("CFATEST_FORK_EXEC_TEXT")) return true_main(argv[0]);
+	check_main(argv[0]);
 
 	printf("arguments are:\n");
@@ -42,41 +30,7 @@
 }
 
-int do_wait(pid_t pid) {
-	int wstatus;
-	int options = 0;
-	pid_t ret = waitpid(pid, &wstatus, options);
-	fflush(stdout);
-	if(ret < 0) {
-		fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno));
-		exit(1);
-	}
-	return wstatus;
-}
 
-pid_t strict_fork(void) {
-	fflush(stdout);
-	pid_t ret = fork();
-	if(ret < 0) {
-		fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno));
-		exit(1);
-	}
-	return ret;
-}
 
-void print_status(int wstatus) {
-	printf("Child status:\n");
-	printf("    WIFEXITED   : %d\n", WIFEXITED(wstatus));
-	printf("    WEXITSTATUS : %d\n", WEXITSTATUS(wstatus));
-	printf("    WIFSIGNALED : %d\n", WIFSIGNALED(wstatus));
-	printf("    WTERMSIG    : %d\n", WTERMSIG(wstatus));
-	printf("    WCOREDUMP   : %d\n", WCOREDUMP(wstatus));
-	printf("    WIFSTOPPED  : %d\n", WIFSTOPPED(wstatus));
-	printf("    WSTOPSIG    : %d\n", WSTOPSIG(wstatus));
-	printf("    WIFCONTINUED: %d\n", WIFCONTINUED(wstatus));
-}
-
-int true_main(const char * path) {
-	char * env[] = { "CFATEST_FORK_EXEC_TEXT=1", 0p };
-
+int true_main(const char * path, char * env[]) {
 	printf("no arg:\n");
 	if(pid_t child = strict_fork(); child == 0) {
Index: tests/meta/fork+exec.hfa
===================================================================
--- tests/meta/fork+exec.hfa	(revision a25bcf8ab29dde92e982540e533dcee4c347fd63)
+++ tests/meta/fork+exec.hfa	(revision a25bcf8ab29dde92e982540e533dcee4c347fd63)
@@ -0,0 +1,72 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2022 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// fork+exec.hfa -- tools for using fork + exec
+//
+// Author           : Thierry Delisle
+// Created On       : Thu Oct 06 14:02:46 2022
+// Last Modified By :
+// Last Modified On :
+// Update Count     :
+//
+
+#include <stdarg.h>										// va_start, va_end
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <errno.h>
+#include <signal.h>
+
+extern "C" {
+	#include <sys/types.h>
+	#include <sys/wait.h>
+	#include <unistd.h>
+}
+
+static int true_main(const char * exec, char * env[]);
+
+static int do_wait(pid_t pid) {
+	int wstatus;
+	int options = 0;
+	pid_t ret = waitpid(pid, &wstatus, options);
+	fflush(stdout);
+	if(ret < 0) {
+		fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno));
+		exit(1);
+	}
+	return wstatus;
+}
+
+static pid_t strict_fork(void) {
+	fflush(stdout);
+	pid_t ret = fork();
+	if(ret < 0) {
+		fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno));
+		exit(1);
+	}
+	if(ret == 0) dup2(1, 2);
+	return ret;
+}
+
+static void print_status(int wstatus) {
+	printf("Child status:\n");
+	printf("    WIFEXITED   : %d\n", WIFEXITED(wstatus));
+	printf("    WEXITSTATUS : %d\n", WEXITSTATUS(wstatus));
+	printf("    WIFSIGNALED : %d\n", WIFSIGNALED(wstatus));
+	printf("    WTERMSIG    : %d\n", WTERMSIG(wstatus));
+	printf("    WCOREDUMP   : %d\n", WCOREDUMP(wstatus));
+	printf("    WIFSTOPPED  : %d\n", WIFSTOPPED(wstatus));
+	printf("    WSTOPSIG    : %d\n", WSTOPSIG(wstatus));
+	printf("    WIFCONTINUED: %d\n", WIFCONTINUED(wstatus));
+}
+
+static void check_main(const char * path) {
+	if(getenv("CFATEST_FORK_EXEC_TEXT")) return;
+
+	char * env[] = { "CFATEST_FORK_EXEC_TEXT=1", 0p };
+	exit( true_main(path, env) );
+}
