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