1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) 2018 Linux Test Project 4 * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz> 5 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 6 * AUTHOR : William Roske 7 * CO-PILOT : Dave Fenner 8 */ 9 10#include <sys/types.h> 11#include <sys/wait.h> 12#include <errno.h> 13#include <signal.h> 14#include <stdlib.h> 15#include <string.h> 16 17#include "tst_test.h" 18 19static void verify_execv(void) 20{ 21 pid_t pid; 22 char *const args[] = { "execv01_child", "canary", NULL}; 23 char path[512]; 24 25 if (tst_get_path("execv01_child", path, sizeof(path))) 26 tst_brk(TCONF, "Couldn't find execv01_child in $PATH"); 27 28 pid = SAFE_FORK(); 29 if (pid == 0) { 30 TEST(execv(path, args)); 31 tst_brk(TFAIL | TTERRNO, "Failed to execute execv01_child"); 32 } 33} 34 35static struct tst_test test = { 36 .forks_child = 1, 37 .child_needs_reinit = 1, 38 .test_all = verify_execv, 39}; 40