all: Switch the --lang syntax to use argv instead

It was a bit awkward using `mgmt run lang --lang <input>` so instead, we
now drop the --lang, and read the positional argv for the input.

This also does the same for the --yaml frontend.
This commit is contained in:
James Shubin
2019-05-05 10:37:53 -04:00
parent b3632584c3
commit 43839d1090
42 changed files with 91 additions and 78 deletions

View File

@@ -5,7 +5,7 @@
mkdir -p "${MGMT_TMPDIR}"
echo > "${MGMT_TMPDIR}"sshd_config
$TIMEOUT "$MGMT" run --tmp-prefix yaml --yaml=augeas-1.yaml &
$TIMEOUT "$MGMT" run --tmp-prefix yaml augeas-1.yaml &
pid=$!
# kill server on error

View File

@@ -14,7 +14,7 @@ if [[ ! "$tmpdir" =~ "/tmp" ]]; then
exit 99
fi
env TMPDIR="${tmpdir}" TEST=123 EMPTY="" $TIMEOUT "$MGMT" run --tmp-prefix --converged-timeout=5 lang --lang env0.mcl
env TMPDIR="${tmpdir}" TEST=123 EMPTY="" $TIMEOUT "$MGMT" run --tmp-prefix --converged-timeout=5 lang env0.mcl
e=$?
egrep "$regex" "$tmpdir/environ" || fail_test "Could not match '$(cat "$tmpdir/environ")' in '$tmpdir/environ' to '$regex'."

View File

@@ -17,7 +17,7 @@ sleep 10s
$TIMEOUT "$MGMT" run --hostname h4 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2385 --server-urls http://127.0.0.1:2386 --tmp-prefix --no-pgp empty &
pid4=$!
sleep 10s
$TIMEOUT "$MGMT" deploy --no-git --seeds http://127.0.0.1:2379 lang --lang exchange0.mcl
$TIMEOUT "$MGMT" deploy --no-git --seeds http://127.0.0.1:2379 lang exchange0.mcl
# kill servers on error/exit
#trap 'pkill -9 mgmt' EXIT

View File

@@ -4,7 +4,7 @@
# time ./mgmt run --hostname h2 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2381 --server-urls http://127.0.0.1:2382 --tmp-prefix --no-pgp empty
# time ./mgmt run --hostname h3 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2383 --server-urls http://127.0.0.1:2384 --tmp-prefix --no-pgp empty
# time ./mgmt run --hostname h4 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2385 --server-urls http://127.0.0.1:2386 --tmp-prefix --no-pgp empty
# time ./mgmt deploy --no-git --seeds http://127.0.0.1:2379 lang --lang examples/lang/exchange0.mcl
# time ./mgmt deploy --no-git --seeds http://127.0.0.1:2379 lang examples/lang/exchange0.mcl
import "sys"
import "world"

View File

@@ -5,7 +5,7 @@
# should take a few seconds plus converged timeout, and test we don't hang!
# TODO: should we return a different exit code if the resources fail?
# TODO: should we be converged if one of the resources has permanently failed?
$TIMEOUT "$MGMT" run --converged-timeout=15 --no-watch --no-pgp --tmp-prefix yaml --yaml exec-fail.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=15 --no-watch --no-pgp --tmp-prefix yaml exec-fail.yaml &
# there's no ^C sent... it should shutdown on its own
pid=$!
wait $pid # get exit status

View File

@@ -40,7 +40,7 @@ function run_usergroup_test() {
setup
# run till completion
sudo -A $TIMEOUT "$MGMT" run --converged-timeout=15 --no-watch --tmp-prefix yaml --yaml ./exec-usergroup/${graph} &
sudo -A $TIMEOUT "$MGMT" run --converged-timeout=15 --no-watch --tmp-prefix yaml ./exec-usergroup/${graph} &
pid=$!
wait $pid # get exit status
e=$?

View File

@@ -5,7 +5,7 @@
set -x
# run till completion
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml --yaml file-mode.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml file-mode.yaml &
pid=$!
wait $pid # get exit status
e=$?

View File

@@ -9,7 +9,7 @@ exit 0
mkdir -p /tmp/mgmt/a/b/c/
# run empty graph, with prometheus support
$TIMEOUT "$MGMT" run --tmp-prefix yaml --yaml=examples/deep-dirs.yaml &
$TIMEOUT "$MGMT" run --tmp-prefix yaml examples/deep-dirs.yaml &
pid=$!
sleep 10s # let it converge

View File

@@ -6,7 +6,7 @@ mkdir -p /tmp/mgmt/
rm /tmp/mgmt/f1 &>/dev/null || true
# run empty graph, with prometheus support
$TIMEOUT "$MGMT" run --tmp-prefix yaml --yaml=file-move.yaml 2>&1 | tee /tmp/mgmt/file-move.log &
$TIMEOUT "$MGMT" run --tmp-prefix yaml file-move.yaml 2>&1 | tee /tmp/mgmt/file-move.log &
pid=$!
sleep 5s # let it converge

View File

@@ -11,7 +11,7 @@ if ! timeout 1s sudo -A true; then
fi
# run till completion
$TIMEOUT sudo -A "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml --yaml file-owner.yaml &
$TIMEOUT sudo -A "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml file-owner.yaml &
pid=$!
wait $pid # get exit status
e=$?

View File

@@ -11,7 +11,7 @@ if ! timeout 1s sudo -A true; then
fi
# run till completion
$TIMEOUT sudo -A "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix lang --lang file-source.mcl &
$TIMEOUT sudo -A "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix lang file-source.mcl &
pid=$!
wait $pid # get exit status
e=$?

View File

@@ -5,7 +5,7 @@
# should take 15 seconds for longest resources plus startup time to shutdown
# we don't want the ^C to allow the rest of the graph to continue executing!
# this is a test of mgmt exiting quickly via a fast pause after it sees a ^C
$TIMEOUT "$MGMT" run --no-watch --no-pgp --tmp-prefix lang --lang graph-exit1.mcl &
$TIMEOUT "$MGMT" run --no-watch --no-pgp --tmp-prefix lang graph-exit1.mcl &
pid=$!
sleep 5s # let the initial resources start to run...
killall -SIGINT mgmt # send ^C to exit mgmt

View File

@@ -4,7 +4,7 @@
# should take 15 seconds for longest resources plus startup time to shutdown
# we don't want the ^C to allow the rest of the graph to continue executing!
$TIMEOUT "$MGMT" run --no-watch --no-pgp --tmp-prefix yaml --yaml graph-exit2.yaml &
$TIMEOUT "$MGMT" run --no-watch --no-pgp --tmp-prefix yaml graph-exit2.yaml &
pid=$!
sleep 10s # let the initial resources start to run...
killall -SIGINT mgmt # send ^C to exit mgmt

View File

@@ -3,7 +3,7 @@
. "$(dirname "$0")/../util.sh"
# should take more than 25s plus overhead
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix --no-pgp yaml --yaml graph-fanin-1.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix --no-pgp yaml graph-fanin-1.yaml &
pid=$!
wait $pid # get exit status
exit $?

View File

@@ -37,7 +37,7 @@ file "${tmpdir}/loadavg" {
}
EOF
$TIMEOUT "$MGMT" run --tmp-prefix --converged-timeout=15 lang --lang "$tmpdir/load0.mcl" &
$TIMEOUT "$MGMT" run --tmp-prefix --converged-timeout=15 lang "$tmpdir/load0.mcl" &
pid=$!
wait $pid # get exit status
e=$?

View File

@@ -52,7 +52,7 @@ sudo mkdir -p /etc/systemd/network
sudo ip link add $IFACE type dummy || true
# run mgmt net res with $IFACE and $ADDR set as above
sudo -A $TIMEOUT "$MGMT" run --converged-timeout=5 --tmp-prefix lang --lang ./net0.mcl &
sudo -A $TIMEOUT "$MGMT" run --converged-timeout=5 --tmp-prefix lang ./net0.mcl &
pid1=$!
# give the engine time to start up
@@ -93,7 +93,7 @@ wait $pid1
e1=$?
# run mgmt net res with $IFACE state => "down"
sudo -A $TIMEOUT "$MGMT" run --converged-timeout=5 --tmp-prefix lang --lang ./net1.mcl &
sudo -A $TIMEOUT "$MGMT" run --converged-timeout=5 --tmp-prefix lang ./net1.mcl &
# give the engine time to start up
sleep 5

View File

@@ -5,7 +5,7 @@
exit 0 # XXX: temporarily disabled until prometheus is added back post refactor
# run a graph, with prometheus support
$TIMEOUT "$MGMT" run --tmp-prefix --no-pgp --prometheus yaml --yaml prometheus-3.yaml &
$TIMEOUT "$MGMT" run --tmp-prefix --no-pgp --prometheus yaml prometheus-3.yaml &
pid=$!
sleep 10s # let it converge

View File

@@ -5,7 +5,7 @@
exit 0 # XXX: temporarily disabled until prometheus is added back post refactor
# run a graph, with prometheus support
$TIMEOUT "$MGMT" run --tmp-prefix --no-pgp --prometheus yaml --yaml prometheus-4.yaml &
$TIMEOUT "$MGMT" run --tmp-prefix --no-pgp --prometheus yaml prometheus-4.yaml &
pid=$!
sleep 15s # let it converge

View File

@@ -4,7 +4,7 @@
# should take at least 55s, but fail if we block this
# TODO: it would be nice to make sure this test doesn't exit too early!
$TIMEOUT "$MGMT" run --sema 2 --converged-timeout=5 --no-watch --no-pgp --tmp-prefix yaml --yaml sema-1.yaml &
$TIMEOUT "$MGMT" run --sema 2 --converged-timeout=5 --no-watch --no-pgp --tmp-prefix yaml sema-1.yaml &
pid=$!
wait $pid # get exit status
exit $?

View File

@@ -4,7 +4,7 @@
# should take at least 55s, but fail if we block this
# TODO: it would be nice to make sure this test doesn't exit too early!
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --no-pgp --tmp-prefix lang --lang sema-2.mcl &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --no-pgp --tmp-prefix lang sema-2.mcl &
pid=$!
wait $pid # get exit status
exit $?

View File

@@ -3,7 +3,7 @@
. "$(dirname "$0")/../util.sh"
# run till completion
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml --yaml t2.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml t2.yaml &
pid=$!
wait $pid # get exit status
e=$?

View File

@@ -12,11 +12,11 @@ fi
mkdir -p "${MGMT_TMPDIR}"mgmt{A..C}
# run till completion
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml --yaml t3-a.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml t3-a.yaml &
pid1=$!
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml --yaml t3-b.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml t3-b.yaml &
pid2=$!
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml --yaml t3-c.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --tmp-prefix yaml t3-c.yaml &
pid3=$!
wait $pid1 # get exit status

View File

@@ -3,7 +3,7 @@
. "$(dirname "$0")/../util.sh"
# should take slightly more than 35s, but fail if we take much longer)
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --no-pgp --tmp-prefix yaml --yaml t5.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --no-pgp --tmp-prefix yaml t5.yaml &
pid=$!
wait $pid # get exit status
exit $?

View File

@@ -3,7 +3,7 @@
. "$(dirname "$0")/../util.sh"
# should take slightly more than 35s, but fail if we take much longer)
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --no-pgp --tmp-prefix yaml --yaml t5b.yaml &
$TIMEOUT "$MGMT" run --converged-timeout=5 --no-watch --no-pgp --tmp-prefix yaml t5b.yaml &
pid=$!
wait $pid # get exit status
exit $?

View File

@@ -3,7 +3,7 @@
. "$(dirname "$0")/../util.sh"
# run till completion
$TIMEOUT "$MGMT" run --no-watch --tmp-prefix yaml --yaml t6.yaml &
$TIMEOUT "$MGMT" run --no-watch --tmp-prefix yaml t6.yaml &
pid=$!
sleep 10s # let it converge
test -e /tmp/mgmt/f1

View File

@@ -16,7 +16,7 @@ fi
# set the config file
cp -a yaml-change1a.yaml /tmp/mgmt/yaml-change.yaml
$TIMEOUT "$MGMT" run --tmp-prefix yaml --yaml /tmp/mgmt/yaml-change.yaml &
$TIMEOUT "$MGMT" run --tmp-prefix yaml /tmp/mgmt/yaml-change.yaml &
pid=$!
sleep 5s # let it converge
grep -q 'hello world' /tmp/mgmt/change1 # check contents are correct