aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-12-01 23:11:39 +0200
committerSergey Poznyakoff <gray@gnu.org>2020-12-02 08:11:26 +0200
commitc0f4c3b99bb3364fe3f840b1ecb44af2eeba097b (patch)
tree374bc9fe1a9802d97f027b56ddf9a1f59268fb4e /tests
parentc26297063aa2dad0fecd28791a47a8bffcfc9925 (diff)
downloadpies-c0f4c3b99bb3364fe3f840b1ecb44af2eeba097b.tar.gz
pies-c0f4c3b99bb3364fe3f840b1ecb44af2eeba097b.tar.bz2
New component flag: expandenv
* NEWS: Update. * doc/pies.texi: Document the expandenv flag. * src/comp.c (component_finish): Warn if both "shell" and "expandenv" are used together. Expand command to argc/argv only unless the CF_EXPANDENV flag is given. * src/pies.c (str_to_cf): New flag: expandenv * src/pies.h (CF_EXPANDENV): New define. * src/prog.h (struct prog): New member: argv. * src/progman.c (destroy_prog): Free argv. (prog_start_prologue): Expand the command line taking into account the current environment if CF_EXPANDENV flag is given. Otherwise, copy the component argv to the prog. (prog_execute): Use prog->v.p.argv * tests/Makefile.am: Add expandenv.at * tests/testsuite.at: Likewise. * tests/expandenv.at: New file.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/expandenv.at50
-rw-r--r--tests/testsuite.at3
3 files changed, 53 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bfdc692..6a9a0d8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -55,6 +55,7 @@ TESTSUITE_AT = \
cyclic.at\
env.at\
envop.at\
+ expandenv.at\
inet.at\
maxinst.at\
passfd.at\
diff --git a/tests/expandenv.at b/tests/expandenv.at
new file mode 100644
index 0000000..5518472
--- /dev/null
+++ b/tests/expandenv.at
@@ -0,0 +1,50 @@
+# This file is part of GNU pies testsuite. -*- Autotest -*-
+# Copyright (C) 2016-2020 Sergey Poznyakoff
+#
+# GNU pies 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 3, or (at your option)
+# any later version.
+#
+# GNU pies 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 GNU pies. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([flags expandenv])
+
+AT_CHECK([
+PIES_XFAIL_CHECK
+PIES_CONTROL_INIT
+statefile=$PWD/state
+cat > pies.conf <<EOT
+component test {
+ mode respawn;
+ flags expandenv;
+ command "\$auxdir/respawn \$statefile 3";
+ chdir "$PWD";
+ return-code 1 {
+ action disable;
+ exec "piesctl --url unix:///$PWD/pies.ctl --no-netrc shutdown";
+ }
+}
+EOT
+
+export auxdir
+export statefile
+
+set -e
+to 5 \
+ pies --foreground --stderr \
+ --config-file control.conf --config-file pies.conf --debug 4 2>errlog
+
+cat state
+],
+[0],
+[3
+])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index eab643d..277cf8b 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,4 +1,4 @@
-# This file is part of GNU pies testsuite. -*- Autotest -*-
+# This file is part of GNU pies testsuite. -*- autotest -*-
# Copyright (C) 2016-2020 Sergey Poznyakoff
#
# GNU pies is free software; you can redistribute it and/or modify
@@ -69,6 +69,7 @@ m4_include([ret-notify.at])
m4_include([startup.at])
m4_include([shutdown.at])
m4_include([shell.at])
+m4_include([expandenv.at])
m4_include([inet.at])
m4_include([maxinst.at])
m4_include([builtin.at])

Return to:

Send suggestions and report system problems to the System administrator.