homectl,TEST-46: fix test and fix homectl return value, update docs

The usual: the test wasn't testing, so we didn't notice that the
command wasn't returning as expected.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-04-08 10:34:28 +02:00
parent f49467b959
commit b9bfa250f2
3 changed files with 11 additions and 3 deletions

View file

@ -846,6 +846,10 @@
<title>Exit status</title>
<para>On success, 0 is returned, a non-zero failure code otherwise.</para>
<para>When a command is invoked with <command>with</command>, the exit status of the child is
propagated. Effectively, <command>homectl</command> will exit without error if the command is
successfully invoked <emphasis>and</emphasis> finishes successfully.</para>
</refsect1>
<xi:include href="common-variables.xml" />

View file

@ -3362,4 +3362,4 @@ static int run(int argc, char *argv[]) {
return dispatch_verb(argc, argv, verbs, NULL);
}
DEFINE_MAIN_FUNCTION(run);
DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);

View file

@ -66,11 +66,15 @@ inspect test-user
PASSWORD=xEhErW0ndafV4s homectl deactivate test-user
inspect test-user
! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
&& { echo 'unexpected success'; exit 1; }
PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz
! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
&& { echo 'unexpected success'; exit 1; }
homectl remove test-user