# HG changeset patch # User Paul Boddie # Date 1715361708 -7200 # Node ID 566e765389a1a477f8ac17845ea558ee0b5d08aa # Parent 0b47f4fa108b59c12c052686865a06570f3ceb35 Added a test of the systemv function for the invocation of programs. diff -r 0b47f4fa108b -r 566e765389a1 test_files/programs/Makefile --- a/test_files/programs/Makefile Fri May 10 19:19:33 2024 +0200 +++ b/test_files/programs/Makefile Fri May 10 19:21:48 2024 +0200 @@ -1,7 +1,7 @@ PKGDIR ?= .. L4DIR ?= $(PKGDIR)/../../.. -TARGET = cat clip dstest_exec_payload ls +TARGET = cat clip dstest_exec_payload ls test_systemv MODE = static_newlib @@ -13,6 +13,8 @@ SRC_C_ls = ls.c +SRC_C_test_systemv = test_systemv.c + REQUIRES_LIBS = libe2access include $(L4DIR)/mk/prog.mk diff -r 0b47f4fa108b -r 566e765389a1 test_files/programs/test_systemv.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test_files/programs/test_systemv.c Fri May 10 19:21:48 2024 +0200 @@ -0,0 +1,50 @@ +/* + * Run a program using the supplied arguments. + * + * Copyright (C) 2024 Paul Boddie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#include +#include + +/* NOTE: To be provided via a header. */ + +extern int systemv(int, const char *[]); + + + +/* List objects in the filesystem image. */ + +int main(int argc, char *argv[]) +{ + int result; + + printf("Running: %s\n", argv[1]); + + result = systemv(argc - 1, (const char **) argv + 1); + + if (result == -1) + printf("Error: %d\n", errno); + else + printf("Result: %d\n", result); + + return 0; +} + +/* vim: tabstop=4 expandtab shiftwidth=4 +*/