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