After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691336 - Add gvfs-testbed so that we can run the Drive tests
Add gvfs-testbed so that we can run the Drive tests
Status: RESOLVED OBSOLETE
Product: gvfs
Classification: Core
Component: udisks2 volume monitor
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2013-01-08 10:07 UTC by Martin Pitt
Modified: 2018-09-21 17:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add gvfs-testbed to enable tests which need root (14.86 KB, patch)
2013-01-08 11:12 UTC, Martin Pitt
none Details | Review
Add gvfs-testbed to enable tests which need root (15.54 KB, patch)
2013-02-01 14:40 UTC, Martin Pitt
committed Details | Review
gvfs-test: Check for URI string presence on CLI unmount (1.33 KB, patch)
2013-02-05 14:56 UTC, Tomas Bzatek
committed Details | Review
Fedora run log (4.60 KB, text/plain)
2013-02-05 15:42 UTC, Tomas Bzatek
  Details

Description Martin Pitt 2013-01-08 10:07:47 UTC
tests/gvfs-test has tests to check the udisks2 backend; these need the scsi_debug kernel module and running some commands as root, such as injecting a temporary udev rule for working around some scsi_debug limitations and running udisksd under a mock polkit daemon. These are the remaining tests which cannot be run as normal user, and thus currently are skipped when running "make check".

In Ubuntu I have a "gvfs-testbed" script which sets up some unshared tmpdir overlays as a sandbox (to ensure that the tests don't destroy anything in the real system), set up a temporary user etc. This also enables the Sftp.test_unknown_host, as this depends on a particular client-side configuration and ssh does not allow using a temporary $HOME.

This bug tracks adding gvfs-testbed to upstream, and integrating it into "make installcheck".
Comment 1 Martin Pitt 2013-01-08 11:12:17 UTC
Created attachment 232960 [details] [review]
Add gvfs-testbed to enable tests which need root

With this, running "make installcheck" as root will run through all the checks, against the system installed binaries. Please note that this is not currently integrated into "make check", as plugging together jhbuild, run-in-tree.sh, and gvfs-testbed.py would be rather complex.

The gvfs-testbed script is rather complex right now, as it also sets up a full samba configuration in the sandbox (avoiding the need for the $LIBSMB_PROG hack, and thus testing the smb backend under more realistic conditions). For merely making the Drive tests work it could be simplified a lot by dropping all the user/home/etc setup; but that it also needed for the Sftp test, and future tests might need those as well.

This already includes a lot of adjustments to get this running on current Fedora, but re-testing would be appreciated.

Thanks for considering!
Comment 2 Tomas Bzatek 2013-01-29 14:33:21 UTC
Review of attachment 232960 [details] [review]:

Overall looks good, I admire your courage to dive in the things that will always be fragile and closely tight to specific distributions. Tested on Fedora rawhide, it mostly runs fine, I'm getting some errors that are unrelated. I will not attempt to add support for other distros as it would make code look messy and there are too many specific things that would have to be changed.

Two minor things found by reading the code:

- Makefile.am should probably list new files in EXTRA_DIST

::: test/test_polkitd.py
@@ +7,3 @@
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by

This pulls GPLv2+ in the tree, most of the sources are LGPLv2+ and trashlib is GPLv3. Any chance this could be relicensed?
Comment 3 Martin Pitt 2013-01-29 17:10:10 UTC
(In reply to comment #2)
> Overall looks good, I admire your courage to dive in the things that will
> always be fragile and closely tight to specific distributions.

Heh, thanks for saying "this is a horrible distro-specific hack" in such a polite manner. :-)

I'm still a bit torn of making this as small as possible, but then discovering later on (when we add new tests) that we need it after all, or having the full test bed right from the start.

But then again, if it starts breaking and getting in the way, we can always remove it again.

> I'm getting some errors that are unrelated.

Out of interest, which ones? If nothing else, should the failure messages be clearer?

> - Makefile.am should probably list new files in EXTRA_DIST

Right, thanks for spotting.

> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> 
> This pulls GPLv2+ in the tree, most of the sources are LGPLv2+ and trashlib is
> GPLv3. Any chance this could be relicensed?

No problem at all. I'll move it to LGPL2+ then to follow the majority of the source then.

I'll send an updated patch in a bit, thanks for the first review!
Comment 4 Martin Pitt 2013-02-01 14:40:47 UTC
Created attachment 234985 [details] [review]
Add gvfs-testbed to enable tests which need root

This updates the license on test_polkit.py and adds the files to Makefile.am.

For the record, test_polkity.py should soon be obsolete. This is being copied between udisks' and gvfs' tests now, originating from aptdaemon. We have python-dbusmock in Ubuntu and Fedora now, which can do this sort of thing much more easily.
I filed https://bugs.launchpad.net/python-dbusmock/+bug/1112551 to remind me to add it as a general template to dbusmock, so that it'll become a five-line replacement.

I'm still curious what currently fails for you on Fedora.
Comment 5 Tomas Bzatek 2013-02-05 14:56:17 UTC
Created attachment 235215 [details] [review]
gvfs-test: Check for URI string presence on CLI unmount

(In reply to comment #4)
> I'm still curious what currently fails for you on Fedora.

For a long time I was confused why tests are failing at unmount on some Fedora installations even though I didn't see any obvious error in the logs. I've finally found a difference - stray virtual CD-ROM mount making our unmount checks confused.

This patch changes the way we're checking whether the mount is still present, by checking the URI string itself. It's quite fragile as we won't detect the mount if the URI string doesn't match the mounted one. Fortunately it's not the case with current tests.

With this patch I'm not getting errors anymore, except of some "Directory not empty: 'gvfs-metadata'" python traceback which I will debug in a moment.
Comment 6 Tomas Bzatek 2013-02-05 15:19:46 UTC
Review of attachment 234985 [details] [review]:

Thanks for relicensing, I think it's ready for merge now. I'm still seeing some minor issues on Fedora, let's deal with them separately.
Comment 7 Tomas Bzatek 2013-02-05 15:42:03 UTC
Created attachment 235222 [details]
Fedora run log

Attaching log from run on rawhide. Most messages could be ignored I think as some errors are handled anyway.

Things worth looking at:
> httpd: Could not open configuration file /etc/httpd/conf/httpd.conf: No such file or directory
> ======================================================================
> ERROR: setUpClass (__main__.Dav)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/gvfs-testbed-script", line 1263, in setUpClass
>     klass.mod_dir = klass.get_httpd_module_dir()
>   File "/home/gvfs-testbed-script", line 1373, in get_httpd_module_dir
>     assert ctl.returncode == 0, httpd_cmd + ' -V failed'
> AssertionError: httpd -V failed

I think the problem here is that "httpd -V" is trying to read configuration from /etc/httpd/ which doesn't exist under testbed.

If I try to copy original configuration from /etc/httpd in the testbed root, I only get "DocumentRoot must be a directory" since it doesn't exist. We may need more heuristics for getting apache module dir.

> ======================================================================
> ERROR: setUpClass (__main__.Drive)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/gvfs-testbed-script", line 845, in setUpClass
>     klass.root_command_success('modprobe scsi_debug add_host=0 dev_size_mb=64')
>   File "/home/gvfs-testbed-script", line 150, in root_command_success
>     raise SystemError('command "%s" failed with code %i:\n%s' % (command, code, err))
> SystemError: command "modprobe scsi_debug add_host=0 dev_size_mb=64" failed with code 1:
> modprobe: ERROR: could not insert 'scsi_debug': Operation not permitted

No idea why this fails, module is unloaded before test run, selinux turned off and issuing the command in root terminal works just fine. Something with ./rootsh spawning?
Comment 8 Martin Pitt 2013-02-07 08:08:52 UTC
Comment on attachment 235215 [details] [review]
gvfs-test: Check for URI string presence on CLI unmount

This looks fine, thanks!
Comment 9 Martin Pitt 2013-02-07 08:18:22 UTC
Comment on attachment 234985 [details] [review]
Add gvfs-testbed to enable tests which need root

I'd like to fix the scsi_debug and httpd problems first, as otherwise the testbed script will be fairly useless (it entirely skips the Dav and Drive tests).

But with current trunk I even get some unstable Drive tests on Ubuntu; might be related to the recent GVolumeMonitor patches, I'll investigate that first.
Comment 10 Tomas Bzatek 2013-02-08 16:01:05 UTC
(In reply to comment #8)
> (From update of attachment 235215 [details] [review])
> This looks fine, thanks!

Pushed as a27fc080c1c6c09720c31bc8f323913ad8a772cb.

(In reply to comment #9)
> But with current trunk I even get some unstable Drive tests on Ubuntu; might be
> related to the recent GVolumeMonitor patches, I'll investigate that first.

There weren't many changes lately, can only see some "can_stop" changes.
Comment 11 Martin Pitt 2013-02-12 05:14:21 UTC
Comment on attachment 234985 [details] [review]
Add gvfs-testbed to enable tests which need root

(In reply to comment #9)
> But with current trunk I even get some unstable Drive tests on Ubuntu; might be
> related to the recent GVolumeMonitor patches, I'll investigate that first.

Oh, of course. "sudo make installcheck" uses gvfs 1.15.2, which didn't have your "Implement proper org.gtk.vfs.MountTracker.UnregisterMount()" patch applied yet. It works fine with 1.15.3.

So there are no actual regressions on Ubuntu either, and you already ack'ed the patch, so I pushed it.

I leave the bug open until we figure out httpd and why the modprobe fails.
Comment 12 GNOME Infrastructure Team 2018-09-21 17:20:43 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/198.