• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <float.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <errno.h>
33 #include <limits.h>
34 #include <unistd.h>
35 #include <fcntl.h>
36 #include <errno.h>
37 #include <sys/signal.h>
38 #include <math.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 	if ((myproc = fork()) != 0)
56 		return myproc;
57 	else {
58 		char *arglist[] = { func_name, NULL };
59 		execvp(arglist[0], arglist);
60 
61 		fprintf(stderr, "ERROR %s\n", strerror(errno));
62 		abort();
63 	}
64 }
65 
main(int argc,char * argv[])66 int main(int argc, char *argv[])
67 {
68 	char *funct, *bin_path;
69 	pid_t child;
70 
71 	if (argc != 2) {
72 		printf("ERROR: need the path to generation binaries\n");
73 		abort();
74 	}
75 
76 	bin_path = argv[1];
77 
78 	funct = malloc(strlen(bin_path) + MAX_FNAME_LEN);
79 	sprintf(funct, "%s/genceil", bin_path);
80 	child = create_file(funct, 0);
81 	waitpid(child, NULL, 0);
82 
83 	sprintf(funct, "%s/genfabs", bin_path);
84 	child = create_file(funct, 0);
85 	waitpid(child, NULL, 0);
86 
87 	sprintf(funct, "%s/genfloor", bin_path);
88 	child = create_file(funct, 0);
89 	waitpid(child, NULL, 0);
90 
91 	sprintf(funct, "%s/genfmod", bin_path);
92 	child = create_file(funct, 0);
93 	waitpid(child, NULL, 0);
94 
95 	sprintf(funct, "%s/genpow", bin_path);
96 	child = create_file(funct, 0);
97 	waitpid(child, NULL, 0);
98 
99 	sprintf(funct, "%s/gensqrt", bin_path);
100 	child = create_file(funct, 0);
101 	waitpid(child, NULL, 0);
102 
103 	return 0;
104 }
105