Re: [PATCH vd_agent_linux] test-file-xfers: Make test succeed if run as root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

Acked-by: Victor Toso <victortoso@xxxxxxxxxx>

> > ---
> >  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@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]