Merge branch 'wip/hadess/installed-tests' into 'master'

ci: Run installed-tests on Fedora

See merge request GNOME/glib!1230
This commit is contained in:
Philip Withnall 2019-12-04 13:28:48 +00:00
commit 75e29305b8
3 changed files with 62 additions and 7 deletions

View File

@ -50,12 +50,6 @@ fedora-x86_64:
- lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov" - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- .gitlab-ci/run-tests.sh - .gitlab-ci/run-tests.sh
- lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov" - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
# FIXME: We should run all installed tests, but do only this one for now
# because it cannot run uninstalled. Reconfigure with dtrace disabled
# because it breaks static link.
- meson configure -Ddtrace=false _build
- ninja -C _build install
- GLIB_TEST_COMPILATION=1 $HOME/glib-installed/libexec/installed-tests/glib/static-link.py $HOME/glib-installed/lib/pkgconfig
artifacts: artifacts:
reports: reports:
junit: "_build/${CI_JOB_NAME}-report.xml" junit: "_build/${CI_JOB_NAME}-report.xml"
@ -96,6 +90,37 @@ debian-stable-x86_64:
- "_build/meson-logs" - "_build/meson-logs"
- "_build/${CI_JOB_NAME}-report.xml" - "_build/${CI_JOB_NAME}-report.xml"
installed-tests:
extends: .only-default
image: registry.gitlab.gnome.org/gnome/glib/fedora:v5
stage: build
script:
# dtrace is disabled because it breaks the static-link.py test
- meson ${MESON_COMMON_OPTIONS}
--werror
--prefix=/usr --libdir=/usr/lib64
-Dfam=true
-Dinstalled_tests=true
-Ddefault_library=both
-Ddtrace=false
_build
- ninja -C _build
- sudo ninja -C _build install
# FIXME: Add update until stable https://bodhi.fedoraproject.org/updates/FEDORA-2019-161b129d4d
- sudo dnf upgrade -y --enablerepo=updates-testing --advisory=FEDORA-2019-161b129d4d
- GLIB_TEST_COMPILATION=1 gnome-desktop-testing-runner
--report-directory=_build/installed-tests-report/failed/
--log-directory=_build/installed-tests-report/logs/
glib
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
- "_build/installed-tests-report/"
G_DISABLE_ASSERT: G_DISABLE_ASSERT:
extends: .only-default extends: .only-default
image: registry.gitlab.gnome.org/gnome/glib/fedora:v5 image: registry.gitlab.gnome.org/gnome/glib/fedora:v5

View File

@ -61,6 +61,24 @@ assert_remove (const gchar *file)
g_error ("failed to remove %s: %s", file, g_strerror (errno)); g_error ("failed to remove %s: %s", file, g_strerror (errno));
} }
static gboolean
fuse_module_loaded (void)
{
char *contents = NULL;
gboolean ret;
if (!g_file_get_contents ("/proc/modules", &contents, NULL, NULL) ||
contents == NULL)
{
g_free (contents);
return FALSE;
}
ret = (strstr (contents, "\nfuse ") != NULL);
g_free (contents);
return ret;
}
static void static void
test_filesystem_readonly (gconstpointer with_mount_monitor) test_filesystem_readonly (gconstpointer with_mount_monitor)
{ {
@ -87,6 +105,18 @@ test_filesystem_readonly (gconstpointer with_mount_monitor)
return; return;
} }
/* If the fuse module is loaded but there's no /dev/fuse, then we're
* we're probably in a rootless container and won't be able to
* use bindfs to run our tests */
if (fuse_module_loaded () &&
!g_file_test ("/dev/fuse", G_FILE_TEST_EXISTS))
{
g_test_skip ("fuse support is needed to run this test (rootless container?)");
g_free (fusermount);
g_free (bindfs);
return;
}
curdir = g_get_current_dir (); curdir = g_get_current_dir ();
dir_to_mount = g_strdup_printf ("%s/dir_bindfs_to_mount", curdir); dir_to_mount = g_strdup_printf ("%s/dir_bindfs_to_mount", curdir);
file_in_mount = g_strdup_printf ("%s/example.txt", dir_to_mount); file_in_mount = g_strdup_printf ("%s/example.txt", dir_to_mount);

View File

@ -28,7 +28,7 @@ if not 'GLIB_TEST_COMPILATION' in os.environ:
If you wish to run this test, set GLIB_TEST_COMPILATION=1 in the env, If you wish to run this test, set GLIB_TEST_COMPILATION=1 in the env,
and make sure you have glib build dependencies installed, including and make sure you have glib build dependencies installed, including
meson.''') meson.''')
sys.exit(0) sys.exit(77)
if len(sys.argv) != 2: if len(sys.argv) != 2:
print('Usage: {} <gio-2.0.pc dir>'.format(os.path.basename(sys.argv[0]))) print('Usage: {} <gio-2.0.pc dir>'.format(os.path.basename(sys.argv[0])))