1 /*
2  * Copyright (C) Bull S.A. 2001
3  * Copyright (c) International Business Machines  Corp., 2001
4  *
5  *   This program is free software;  you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation; either version 2 of the License, or
8  *   (at your option) any later version.
9  *
10  *   This program is distributed in the hope that it will be useful,
11  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13  *   the GNU General Public License for more details.
14  *
15  *   You should have received a copy of the GNU General Public License
16  *   along with this program;  if not, write to the Free Software
17  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 /******************************************************************************/
21 /*									    */
22 /* Dec-03-2001  Created: Jacky Malcles & Jean Noel Cordenner		  */
23 /*	      These tests are adapted from AIX float PVT tests.	     */
24 /*									    */
25 /******************************************************************************/
26 #include <sys/types.h>
27 #include <sys/wait.h>
28 #include <err.h>
29 #include <errno.h>
30 #include <fcntl.h>
31 #include <float.h>
32 #include <limits.h>
33 #include <math.h>
34 #include <signal.h>
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <string.h>
38 #include <unistd.h>
39 
40 #define	MAX_FNAME_LEN	16
41 
42 /*****************************************************************
43  * create file:
44  *
45  * func_name is the name of the function
46  *
47  * code can take 2 values: DATA_CREATE to create a input data file
48  *			   RESULT_CREATE for output result file
49  */
50 
create_file(char * func_name,int NbVal)51 int create_file(char *func_name, int NbVal)
52 {
53 	pid_t myproc;
54 
55 	switch (myproc = fork()) {
56 	case -1:
57 		err(1, "fork failed");
58 	case 0:{
59 			char *arglist[] = { func_name, NULL };
60 			execvp(arglist[0], arglist);
61 
62 			err(1, "execvp failed");
63 		}
64 	default:
65 		;
66 	}
67 	return myproc;
68 }
69 
main(int argc,char * argv[])70 int main(int argc, char *argv[])
71 {
72 	char *funct, *bin_path;
73 	pid_t child;
74 
75 	if (argc != 2)
76 		err(1, "need the path to generation binaries");
77 
78 	bin_path = argv[1];
79 
80 	funct = malloc(strlen(bin_path) + MAX_FNAME_LEN);
81 	sprintf(funct, "%s/gencosh", bin_path);
82 	child = create_file(funct, 0);
83 	waitpid(child, NULL, 0);
84 
85 	sprintf(funct, "%s/gensinh", bin_path);
86 	child = create_file(funct, 0);
87 	waitpid(child, NULL, 0);
88 
89 	sprintf(funct, "%s/gentanh", bin_path);
90 	child = create_file(funct, 0);
91 	waitpid(child, NULL, 0);
92 
93 	return 0;
94 }
95