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