[Spice-devel] [PATCH vd_agent_linux] test-file-xfers: Make test succeed if run as root
Victor Toso
victortoso at redhat.com
Sat Jan 26 11:20:15 UTC 2019
On Wed, Jan 23, 2019 at 04:30:12PM -0500, Frediano Ziglio wrote:
> ping
>
> >
> > If test is run with root (for instance on Gitlab CI) creating
> > a file on a directory with no permission will succeed and
> > test will fail.
> > Instead create a link trying to create a file in /proc/1
> > directory (which fails also using root account).
> >
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
> > ---
> > tests/test-file-xfers.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > CI results at https://gitlab.freedesktop.org/fziglio/vd_agent/pipelines/15140
> >
> > diff --git a/tests/test-file-xfers.c b/tests/test-file-xfers.c
> > index 41d333e..9995336 100644
> > --- a/tests/test-file-xfers.c
> > +++ b/tests/test-file-xfers.c
> > @@ -65,8 +65,8 @@ int main(int argc, char *argv[])
> > test_file("subdir/test.txt", "./test-dir/subdir/test.txt");
> >
> > // create a file in a directory with no permissions
> > - assert(system("chmod 555 test-dir/subdir") == 0);
> > - test_file("subdir/test2.txt", NULL);
> > + assert(system("ln -s /proc/1 test-dir/baddir") == 0);
> > + test_file("baddir/test2.txt", NULL);
> >
> > // try to create a file with a path where there's a file (should fail)
> > test_file("test.txt/out", NULL);
> > @@ -77,7 +77,7 @@ int main(int argc, char *argv[])
> > // create a file with same name above, should not strip the filename
> > test_file("sub.dir/test", "./test-dir/sub.dir/test (1)");
> >
> > - assert(system("chmod 755 test-dir/subdir && rm -rf test-dir") == 0);
> > + assert(system("rm -rf test-dir") == 0);
> >
> > return 0;
> > }
> > --
> > 2.20.1
> >
> >
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190126/76fedf2c/attachment.sig>
More information about the Spice-devel
mailing list