tests/g-file-info-filesystem-readonly: remove output stream stuff

This test is intended to verify the fix for
https://bugzilla.gnome.org/show_bug.cgi?id=787731, which was that
g_file_query_filesystem_info() would return stale information for the
mount. After replacing a read-only mount with a read-write mount, this
test used to only fail if G_FILE_ATTRIBUTE_FILESYSTEM_READONLY was TRUE
and yet the file could be opened for writing. In particular, if (due to
a test bug) the file really was still on a read-only filesystem, the
test would pass.

Now that we have fixed that bug in the test, we can make a stronger
assertion.
This commit is contained in:
Will Thompson 2018-11-12 14:52:54 +00:00
parent 5b106cdc56
commit a2f32f6a11
No known key found for this signature in database
GPG Key ID: 3422DC0D7AD482A7

View File

@ -151,19 +151,7 @@ test_filesystem_readonly (gconstpointer with_mount_monitor)
g_assert_no_error (error);
g_assert_nonnull (file_info);
if (g_file_info_get_attribute_boolean (file_info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY))
{
/* ¡¡ GIO still reports filesystem as being Readonly !!
* Let's check if that's true by trying to write to file */
GFileOutputStream *write_stream;
write_stream = g_file_append_to (mounted_file, G_FILE_CREATE_NONE, NULL, NULL);
if (write_stream != NULL)
{
/* The file has been opened for writing without error, so ¡¡ GIO IS WRONG !! */
g_object_unref (write_stream);
g_test_fail (); /* Marking test as FAILED */
}
}
g_assert_false (g_file_info_get_attribute_boolean (file_info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY));
/* Clean up */
g_clear_object (&mount_monitor);