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 <string.h> 14f08c3bdfSopenharmony_ci#include <stdlib.h> 15f08c3bdfSopenharmony_ci 16f08c3bdfSopenharmony_ci#include "tst_test.h" 17f08c3bdfSopenharmony_ci 18f08c3bdfSopenharmony_cistatic void verify_execl(void) 19f08c3bdfSopenharmony_ci{ 20f08c3bdfSopenharmony_ci pid_t pid; 21f08c3bdfSopenharmony_ci char path[512]; 22f08c3bdfSopenharmony_ci 23f08c3bdfSopenharmony_ci if (tst_get_path("execl01_child", path, sizeof(path))) 24f08c3bdfSopenharmony_ci tst_brk(TCONF, "Couldn't find execl01_child in $PATH"); 25f08c3bdfSopenharmony_ci 26f08c3bdfSopenharmony_ci pid = SAFE_FORK(); 27f08c3bdfSopenharmony_ci if (pid == 0) { 28f08c3bdfSopenharmony_ci TEST(execl(path, "execl01_child", "canary", NULL)); 29f08c3bdfSopenharmony_ci tst_brk(TFAIL | TTERRNO, 30f08c3bdfSopenharmony_ci "Failed to execute execl01_child"); 31f08c3bdfSopenharmony_ci } 32f08c3bdfSopenharmony_ci} 33f08c3bdfSopenharmony_ci 34f08c3bdfSopenharmony_cistatic struct tst_test test = { 35f08c3bdfSopenharmony_ci .forks_child = 1, 36f08c3bdfSopenharmony_ci .child_needs_reinit = 1, 37f08c3bdfSopenharmony_ci .test_all = verify_execl, 38f08c3bdfSopenharmony_ci}; 39