diff --git a/docs/fwupd-docs.xml b/docs/fwupd-docs.xml
index 050e93c5f..541a189a0 100644
--- a/docs/fwupd-docs.xml
+++ b/docs/fwupd-docs.xml
@@ -63,7 +63,6 @@
-
diff --git a/libfwupdplugin/fu-self-test.c b/libfwupdplugin/fu-self-test.c
index 56b8565a7..6eb2f95dd 100644
--- a/libfwupdplugin/fu-self-test.c
+++ b/libfwupdplugin/fu-self-test.c
@@ -59,8 +59,7 @@ fu_archive_invalid_func (void)
g_autoptr(GBytes) data = NULL;
g_autoptr(GError) error = NULL;
- filename = fu_test_get_filename (TESTDATADIR, "metadata.xml");
- g_assert_nonnull (filename);
+ filename = g_build_filename (TESTDATADIR_SRC, "metadata.xml", NULL);
data = fu_common_get_contents_bytes (filename, &error);
g_assert_no_error (error);
g_assert_nonnull (data);
@@ -81,8 +80,7 @@ fu_archive_cab_func (void)
g_autoptr(GError) error = NULL;
GBytes *data_tmp;
- filename = fu_test_get_filename (TESTDATADIR, "colorhug/colorhug-als-3.0.2.cab");
- g_assert_nonnull (filename);
+ filename = g_build_filename (TESTDATADIR_DST, "colorhug", "colorhug-als-3.0.2.cab", NULL);
data = fu_common_get_contents_bytes (filename, &error);
g_assert_no_error (error);
g_assert_nonnull (data);
@@ -250,9 +248,7 @@ fu_smbios3_func (void)
g_autoptr(FuSmbios) smbios = NULL;
g_autoptr(GError) error = NULL;
- path = fu_test_get_filename (TESTDATADIR, "dmi/tables64");
- g_assert_nonnull (path);
-
+ path = g_build_filename (TESTDATADIR_SRC, "dmi", "tables64", NULL);
smbios = fu_smbios_new ();
ret = fu_smbios_setup_from_path (smbios, path, &error);
g_assert_no_error (error);
@@ -469,8 +465,7 @@ fu_common_firmware_builder_func (void)
g_autoptr(GError) error = NULL;
/* get test file */
- archive_fn = fu_test_get_filename (TESTDATADIR, "builder/firmware.tar");
- g_assert (archive_fn != NULL);
+ archive_fn = g_build_filename (TESTDATADIR_DST, "builder", "firmware.tar", NULL);
archive_blob = fu_common_get_contents_bytes (archive_fn, &error);
g_assert_no_error (error);
g_assert (archive_blob != NULL);
@@ -570,8 +565,7 @@ fu_common_spawn_func (void)
g_autofree gchar *fn = NULL;
const gchar *argv[3] = { "replace", "test", NULL };
- fn = fu_test_get_filename (TESTDATADIR, "spawn.sh");
- g_assert (fn != NULL);
+ fn = g_build_filename (TESTDATADIR_SRC, "spawn.sh", NULL);
argv[0] = fn;
ret = fu_common_spawn_sync (argv,
fu_test_stdout_cb, &lines, 0, NULL, &error);
@@ -589,8 +583,7 @@ fu_common_spawn_timeout_func (void)
g_autofree gchar *fn = NULL;
const gchar *argv[3] = { "replace", "test", NULL };
- fn = fu_test_get_filename (TESTDATADIR, "spawn.sh");
- g_assert (fn != NULL);
+ fn = g_build_filename (TESTDATADIR_SRC, "spawn.sh", NULL);
argv[0] = fn;
ret = fu_common_spawn_sync (argv, fu_test_stdout_cb, &lines, 50, NULL, &error);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
@@ -1268,8 +1261,7 @@ fu_firmware_ihex_func (void)
g_autoptr(GFile) file_hex = NULL;
/* load a Intel hex32 file */
- filename_hex = fu_test_get_filename (TESTDATADIR, "firmware.hex");
- g_assert (filename_hex != NULL);
+ filename_hex = g_build_filename (TESTDATADIR_SRC, "firmware.hex", NULL);
file_hex = g_file_new_for_path (filename_hex);
data_file = g_file_load_bytes (file_hex, NULL, NULL, &error);
g_assert_no_error (error);
@@ -1283,8 +1275,7 @@ fu_firmware_ihex_func (void)
g_assert_cmpint (g_bytes_get_size (data_fw), ==, 136);
/* did we match the reference file? */
- filename_ref = fu_test_get_filename (TESTDATADIR, "firmware.bin");
- g_assert (filename_ref != NULL);
+ filename_ref = g_build_filename (TESTDATADIR_SRC, "firmware.bin", NULL);
file_ref = g_file_new_for_path (filename_ref);
data_ref = g_file_load_bytes (file_ref, NULL, NULL, &error);
g_assert_no_error (error);
@@ -1328,8 +1319,7 @@ fu_firmware_ihex_signed_func (void)
g_autoptr(GFile) file_hex = NULL;
/* load a signed Intel hex32 file */
- filename_shex = fu_test_get_filename (TESTDATADIR, "firmware.shex");
- g_assert (filename_shex != NULL);
+ filename_shex = g_build_filename (TESTDATADIR_SRC, "firmware.shex", NULL);
file_hex = g_file_new_for_path (filename_shex);
data_file = g_file_load_bytes (file_hex, NULL, NULL, &error);
g_assert_no_error (error);
@@ -1413,8 +1403,7 @@ fu_firmware_srec_func (void)
g_autoptr(GFile) file_bin = NULL;
g_autoptr(GFile) file_srec = NULL;
- filename_srec = fu_test_get_filename (TESTDATADIR, "firmware.srec");
- g_assert (filename_srec != NULL);
+ filename_srec = g_build_filename (TESTDATADIR_SRC, "firmware.srec", NULL);
file_srec = g_file_new_for_path (filename_srec);
data_srec = g_file_load_bytes (file_srec, NULL, NULL, &error);
g_assert_no_error (error);
@@ -1428,8 +1417,7 @@ fu_firmware_srec_func (void)
g_assert_cmpint (g_bytes_get_size (data_bin), ==, 136);
/* did we match the reference file? */
- filename_ref = fu_test_get_filename (TESTDATADIR, "firmware.bin");
- g_assert (filename_ref != NULL);
+ filename_ref = g_build_filename (TESTDATADIR_SRC, "firmware.bin", NULL);
file_bin = g_file_new_for_path (filename_ref);
data_ref = g_file_load_bytes (file_bin, NULL, NULL, &error);
g_assert_no_error (error);
@@ -1485,8 +1473,7 @@ fu_firmware_dfu_func (void)
g_autoptr(GFile) file_bin = NULL;
g_autoptr(GFile) file_dfu = NULL;
- filename_dfu = fu_test_get_filename (TESTDATADIR, "firmware.dfu");
- g_assert (filename_dfu != NULL);
+ filename_dfu = g_build_filename (TESTDATADIR_SRC, "firmware.dfu", NULL);
file_dfu = g_file_new_for_path (filename_dfu);
data_dfu = g_file_load_bytes (file_dfu, NULL, NULL, &error);
g_assert_no_error (error);
@@ -1503,8 +1490,7 @@ fu_firmware_dfu_func (void)
g_assert_cmpint (g_bytes_get_size (data_bin), ==, 136);
/* did we match the reference file? */
- filename_ref = fu_test_get_filename (TESTDATADIR, "firmware.bin");
- g_assert (filename_ref != NULL);
+ filename_ref = g_build_filename (TESTDATADIR_SRC, "firmware.bin", NULL);
file_bin = g_file_new_for_path (filename_ref);
data_ref = g_file_load_bytes (file_bin, NULL, NULL, &error);
g_assert_no_error (error);
diff --git a/libfwupdplugin/fu-test.c b/libfwupdplugin/fu-test.c
deleted file mode 100644
index 506eb4cc6..000000000
--- a/libfwupdplugin/fu-test.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2010-2017 Richard Hughes
- *
- * SPDX-License-Identifier: LGPL-2.1+
- */
-
-#include "config.h"
-
-#include
-
-#include
-#include
-
-#include "fu-test.h"
-#include "fu-common.h"
-
-
-/**
- * fu_test_get_filename:
- * @testdatadirs: semicolon delimitted list of directories
- * @filename: the filename to look for
- *
- * Returns the first path that matches filename in testdatadirs
- *
- * Returns: (transfer full): full path to file or NULL
- *
- * Since: 0.9.1
- **/
-gchar *
-fu_test_get_filename (const gchar *testdatadirs, const gchar *filename)
-{
- g_auto(GStrv) split = g_strsplit (testdatadirs, ":", -1);
- for (guint i = 0; split[i] != NULL; i++) {
- g_autofree gchar *tmp = NULL;
- g_autofree gchar *path = NULL;
- path = g_build_filename (split[i], filename, NULL);
- tmp = fu_common_realpath (path, NULL);
- if (tmp != NULL)
- return g_steal_pointer (&tmp);
- }
- return NULL;
-}
diff --git a/libfwupdplugin/fu-test.h b/libfwupdplugin/fu-test.h
deleted file mode 100644
index 203112490..000000000
--- a/libfwupdplugin/fu-test.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright (C) 2010-2011 Richard Hughes
- *
- * SPDX-License-Identifier: LGPL-2.1+
- */
-
-#pragma once
-
-#include
-
-gchar *fu_test_get_filename (const gchar *testdatadirs,
- const gchar *filename);
diff --git a/libfwupdplugin/fwupdplugin.h b/libfwupdplugin/fwupdplugin.h
index 09c70c328..5c647cd55 100644
--- a/libfwupdplugin/fwupdplugin.h
+++ b/libfwupdplugin/fwupdplugin.h
@@ -35,7 +35,6 @@
#include
#include
#include
-#include
#include
#include
diff --git a/libfwupdplugin/fwupdplugin.map b/libfwupdplugin/fwupdplugin.map
index 8236e1dc8..e762f969b 100644
--- a/libfwupdplugin/fwupdplugin.map
+++ b/libfwupdplugin/fwupdplugin.map
@@ -73,7 +73,6 @@ LIBFWUPDPLUGIN_0.8.0 {
LIBFWUPDPLUGIN_0.9.1 {
global:
fu_plugin_check_hwid;
- fu_test_get_filename;
local: *;
} LIBFWUPDPLUGIN_0.8.0;
diff --git a/libfwupdplugin/meson.build b/libfwupdplugin/meson.build
index 837b5a2d0..1d781eea1 100644
--- a/libfwupdplugin/meson.build
+++ b/libfwupdplugin/meson.build
@@ -19,7 +19,6 @@ fwupdplugin_src = [
'fu-quirks.c',
'fu-smbios.c',
'fu-srec-firmware.c',
- 'fu-test.c',
'fu-udev-device.c',
'fu-usb-device.c',
]
@@ -46,7 +45,6 @@ fwupdplugin_headers = [
'fu-quirks.h',
'fu-smbios.h',
'fu-srec-firmware.h',
- 'fu-test.h',
'fu-udev-device.h',
'fu-usb-device.h',
]
@@ -241,7 +239,6 @@ if get_option('tests')
c_args : [
'-DTESTDATADIR_SRC="' + testdatadir_src + '"',
'-DTESTDATADIR_DST="' + testdatadir_dst + '"',
- '-DTESTDATADIR="' + testdatadir_src + ':' + testdatadir_dst + '"',
'-DPLUGINBUILDDIR="' + pluginbuilddir + '"',
],
)
diff --git a/plugins/ata/fu-self-test.c b/plugins/ata/fu-self-test.c
index 02aae8c2e..7614dae41 100644
--- a/plugins/ata/fu-self-test.c
+++ b/plugins/ata/fu-self-test.c
@@ -9,7 +9,6 @@
#include
#include "fu-ata-device.h"
-#include "fu-test.h"
static void
fu_ata_id_func (void)
@@ -21,8 +20,7 @@ fu_ata_id_func (void)
g_autoptr(FuAtaDevice) dev = NULL;
g_autoptr(GError) error = NULL;
- path = fu_test_get_filename (TESTDATADIR, "StarDrive-SBFM61.2.bin");
- g_assert_nonnull (path);
+ path = g_build_filename (TESTDATADIR, "StarDrive-SBFM61.2.bin", NULL);
ret = g_file_get_contents (path, &data, &sz, &error);
g_assert_no_error (error);
g_assert (ret);
diff --git a/plugins/dfu/dfu-self-test.c b/plugins/dfu/dfu-self-test.c
index 20e4a610f..2a1e9ffe1 100644
--- a/plugins/dfu/dfu-self-test.c
+++ b/plugins/dfu/dfu-self-test.c
@@ -16,7 +16,6 @@
#include "dfu-sector.h"
#include "dfu-target-private.h"
-#include "fu-test.h"
#include "fu-common.h"
#include "fwupd-error.h"
diff --git a/plugins/nvme/fu-self-test.c b/plugins/nvme/fu-self-test.c
index e337f2262..9b872bb0b 100644
--- a/plugins/nvme/fu-self-test.c
+++ b/plugins/nvme/fu-self-test.c
@@ -10,7 +10,6 @@
#include "fu-device-private.h"
#include "fu-nvme-device.h"
-#include "fu-test.h"
static void
fu_nvme_cns_func (void)
@@ -22,8 +21,7 @@ fu_nvme_cns_func (void)
g_autoptr(FuNvmeDevice) dev = NULL;
g_autoptr(GError) error = NULL;
- path = fu_test_get_filename (TESTDATADIR, "TOSHIBA_THNSN5512GPU7.bin");
- g_assert_nonnull (path);
+ path = g_build_filename (TESTDATADIR, "TOSHIBA_THNSN5512GPU7.bin", NULL);
ret = g_file_get_contents (path, &data, &sz, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -45,8 +43,8 @@ fu_nvme_cns_all_func (void)
g_autoptr(GDir) dir = NULL;
/* may or may not exist */
- path = fu_test_get_filename (TESTDATADIR, "blobs");
- if (path == NULL)
+ path = g_build_filename (TESTDATADIR, "blobs", NULL);
+ if (!g_file_test (path, G_FILE_TEST_EXISTS))
return;
dir = g_dir_open (path, 0, NULL);
while ((fn = g_dir_read_name (dir)) != NULL) {
diff --git a/plugins/optionrom/fu-self-test.c b/plugins/optionrom/fu-self-test.c
index 468c1b5bd..d3aa79326 100644
--- a/plugins/optionrom/fu-self-test.c
+++ b/plugins/optionrom/fu-self-test.c
@@ -13,7 +13,6 @@
#include "fu-plugin-private.h"
#include "fu-rom.h"
-#include "fu-test.h"
static void
fu_rom_func (void)
@@ -62,8 +61,8 @@ fu_rom_func (void)
g_assert (rom != NULL);
/* load file */
- filename = fu_test_get_filename (TESTDATADIR, data[i].fn);
- if (filename == NULL)
+ filename = g_build_filename (TESTDATADIR, data[i].fn, NULL);
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS))
continue;
g_print ("\nparsing %s...", filename);
file = g_file_new_for_path (filename);
@@ -84,8 +83,8 @@ fu_rom_all_func (void)
g_autofree gchar *path = NULL;
/* may or may not exist */
- path = fu_test_get_filename (TESTDATADIR, "roms");
- if (path == NULL)
+ path = g_build_filename (TESTDATADIR, "roms", NULL);
+ if (!g_file_test (path, G_FILE_TEST_EXISTS))
return;
g_print ("\n");
dir = g_dir_open (path, 0, NULL);
diff --git a/plugins/redfish/fu-self-test.c b/plugins/redfish/fu-self-test.c
index d1ba40d4d..ccebba416 100644
--- a/plugins/redfish/fu-self-test.c
+++ b/plugins/redfish/fu-self-test.c
@@ -9,7 +9,6 @@
#include
#include "fu-plugin-private.h"
-#include "fu-test.h"
#include "fu-redfish-common.h"
diff --git a/plugins/synaptics-prometheus/fu-self-test.c b/plugins/synaptics-prometheus/fu-self-test.c
index 651a68d00..a9b4df72d 100644
--- a/plugins/synaptics-prometheus/fu-self-test.c
+++ b/plugins/synaptics-prometheus/fu-self-test.c
@@ -9,7 +9,6 @@
#include
#include "fu-plugin-private.h"
-#include "fu-test.h"
#include "fu-synaprom-device.h"
#include "fu-synaprom-firmware.h"
@@ -29,8 +28,7 @@ fu_test_synaprom_firmware_func (void)
g_autoptr(FuFirmware) firmware2 = NULL;
g_autoptr(FuFirmware) firmware = fu_synaprom_firmware_new ();
- filename = fu_test_get_filename (TESTDATADIR, "test.pkg");
- g_assert_nonnull (filename);
+ filename = g_build_filename (TESTDATADIR, "test.pkg", NULL);
fw = fu_common_get_contents_bytes (filename, &error);
g_assert_no_error (error);
g_assert_nonnull (fw);
diff --git a/plugins/thunderbolt/fu-self-test.c b/plugins/thunderbolt/fu-self-test.c
index cae122769..888ce8d16 100644
--- a/plugins/thunderbolt/fu-self-test.c
+++ b/plugins/thunderbolt/fu-self-test.c
@@ -24,7 +24,6 @@
#include "fu-plugin-private.h"
#include "fu-thunderbolt-image.h"
-#include "fu-test.h"
static gchar *
udev_mock_add_domain (UMockdevTestbed *bed, int id)
@@ -343,9 +342,7 @@ write_controller_fw (const gchar *nvm)
g_autoptr(GError) error = NULL;
gssize n;
- fw_path = fu_test_get_filename (TESTDATADIR, "thunderbolt/minimal-fw-controller.bin");
- g_assert_nonnull (fw_path);
-
+ fw_path = g_build_filename (TESTDATADIR, "thunderbolt/minimal-fw-controller.bin", NULL);
fw_file = g_file_new_for_path (fw_path);
g_assert_nonnull (fw_file);
@@ -916,8 +913,7 @@ test_set_up (ThunderboltTest *tt, gconstpointer params)
if (flags & TEST_PREPARE_FIRMWARE) {
g_autofree gchar *fw_path = NULL;
- fw_path = fu_test_get_filename (TESTDATADIR, "thunderbolt/minimal-fw.bin");
- g_assert_nonnull (fw_path);
+ fw_path = g_build_filename (TESTDATADIR, "thunderbolt/minimal-fw.bin", NULL);
tt->fw_file = g_mapped_file_new (fw_path, FALSE, &error);
g_assert_no_error (error);
g_assert_nonnull (tt->fw_file);
@@ -1010,10 +1006,8 @@ test_image_validation (ThunderboltTest *tt, gconstpointer user_data)
g_autoptr(GError) error = NULL;
/* image as if read from the controller (i.e. no headers) */
- ctl_path = fu_test_get_filename (TESTDATADIR,
- "thunderbolt/minimal-fw-controller.bin");
- g_assert_nonnull (ctl_path);
-
+ ctl_path = g_build_filename (TESTDATADIR,
+ "thunderbolt/minimal-fw-controller.bin", NULL);
ctl_file = g_mapped_file_new (ctl_path, FALSE, &error);
g_assert_no_error (error);
g_assert_nonnull (ctl_file);
@@ -1022,9 +1016,7 @@ test_image_validation (ThunderboltTest *tt, gconstpointer user_data)
g_assert_nonnull (ctl_data);
/* valid firmware update image */
- fwi_path = fu_test_get_filename (TESTDATADIR, "thunderbolt/minimal-fw.bin");
- g_assert_nonnull (fwi_path);
-
+ fwi_path = g_build_filename (TESTDATADIR, "thunderbolt/minimal-fw.bin", NULL);
fwi_file = g_mapped_file_new (fwi_path, FALSE, &error);
g_assert_no_error (error);
g_assert_nonnull (fwi_file);
@@ -1033,9 +1025,7 @@ test_image_validation (ThunderboltTest *tt, gconstpointer user_data)
g_assert_nonnull (fwi_data);
/* a wrong/bad firmware update image */
- bad_path = fu_test_get_filename (TESTDATADIR, "colorhug/firmware.bin");
- g_assert_nonnull (bad_path);
-
+ bad_path = g_build_filename (TESTDATADIR, "colorhug/firmware.bin", NULL);
bad_file = g_mapped_file_new (bad_path, FALSE, &error);
g_assert_no_error (error);
g_assert_nonnull (bad_file);
diff --git a/plugins/thunderbolt/fu-thunderbolt-tool.c b/plugins/thunderbolt/fu-thunderbolt-tool.c
index 8581201b7..419ba5f7c 100644
--- a/plugins/thunderbolt/fu-thunderbolt-tool.c
+++ b/plugins/thunderbolt/fu-thunderbolt-tool.c
@@ -12,7 +12,6 @@
#include "fu-thunderbolt-image.h"
#include "fu-plugin-vfuncs.h"
#include "fu-hash.h"
-#include "fu-test.h"
static gsize
read_farb_pointer (gchar *image)
diff --git a/plugins/thunderbolt/meson.build b/plugins/thunderbolt/meson.build
index 8abb201c4..06ab34eec 100644
--- a/plugins/thunderbolt/meson.build
+++ b/plugins/thunderbolt/meson.build
@@ -23,9 +23,7 @@ fu_plugin_thunderbolt = shared_module('fu_plugin_thunderbolt',
],
)
-testdatadir_src = join_paths(meson.source_root(), 'data', 'tests')
-testdatadir_dst = join_paths(meson.build_root(), 'data', 'tests')
-cargs += '-DTESTDATADIR="' + testdatadir_src + ':' + testdatadir_dst + '"'
+cargs += '-DTESTDATADIR="' + join_paths(meson.source_root(), 'data', 'tests') + '"'
executable('tbtfwucli',
fu_hash,
sources : [
diff --git a/plugins/uefi/fu-self-test.c b/plugins/uefi/fu-self-test.c
index 860bda291..08ceed389 100644
--- a/plugins/uefi/fu-self-test.c
+++ b/plugins/uefi/fu-self-test.c
@@ -8,7 +8,6 @@
#include
-#include "fu-test.h"
#include "fu-ucs2.h"
#include "fu-uefi-bgrt.h"
#include "fu-uefi-common.h"
@@ -129,8 +128,7 @@ fu_uefi_bitmap_func (void)
g_autofree gchar *buf = NULL;
g_autoptr(GError) error = NULL;
- fn = fu_test_get_filename (TESTDATADIR, "test.bmp");
- g_assert (fn != NULL);
+ fn = g_build_filename (TESTDATADIR, "test.bmp", NULL);
ret = g_file_get_contents (fn, &buf, &sz, &error);
g_assert_no_error (error);
g_assert_true (ret);
@@ -149,8 +147,7 @@ fu_uefi_device_func (void)
g_autoptr(FuUefiDevice) dev = NULL;
g_autoptr(GError) error = NULL;
- fn = fu_test_get_filename (TESTDATADIR, "efi/esrt/entries/entry0");
- g_assert (fn != NULL);
+ fn = g_build_filename (TESTDATADIR, "efi/esrt/entries/entry0", NULL);
dev = fu_uefi_device_new_from_entry (fn, &error);
g_assert_nonnull (dev);
g_assert_no_error (error);
@@ -287,8 +284,7 @@ fu_uefi_update_info_func (void)
g_autoptr(FuUefiUpdateInfo) info = NULL;
g_autoptr(GError) error = NULL;
- fn = fu_test_get_filename (TESTDATADIR, "efi/esrt/entries/entry0");
- g_assert (fn != NULL);
+ fn = g_build_filename (TESTDATADIR, "efi/esrt/entries/entry0", NULL);
dev = fu_uefi_device_new_from_entry (fn, &error);
g_assert_no_error (error);
g_assert_nonnull (dev);
diff --git a/plugins/wacom-usb/fu-self-test.c b/plugins/wacom-usb/fu-self-test.c
index 786568de2..eb5d27ed3 100644
--- a/plugins/wacom-usb/fu-self-test.c
+++ b/plugins/wacom-usb/fu-self-test.c
@@ -10,7 +10,6 @@
#include
#include "fu-common.h"
-#include "fu-test.h"
#include "fu-wac-common.h"
#include "fu-wac-firmware.h"
@@ -28,8 +27,8 @@ fu_wac_firmware_parse_func (void)
g_autoptr(GError) error = NULL;
/* parse the test file */
- fn = fu_test_get_filename (TESTDATADIR, "test.wac");
- if (fn == NULL) {
+ fn = g_build_filename (TESTDATADIR, "test.wac", NULL);
+ if (!g_file_test (fn, G_FILE_TEST_EXISTS)) {
g_test_skip ("no data file found");
return;
}
diff --git a/src/fu-self-test.c b/src/fu-self-test.c
index eb313fb47..cdec24c4b 100644
--- a/src/fu-self-test.c
+++ b/src/fu-self-test.c
@@ -112,8 +112,7 @@ fu_engine_generate_md_func (void)
g_autoptr(XbNode) component = NULL;
/* put cab file somewhere we can parse it */
- filename = fu_test_get_filename (TESTDATADIR, "colorhug/colorhug-als-3.0.2.cab");
- g_assert_nonnull (filename);
+ filename = g_build_filename (TESTDATADIR_DST, "colorhug", "colorhug-als-3.0.2.cab", NULL);
data = fu_common_get_contents_bytes (filename, &error);
g_assert_no_error (error);
g_assert_nonnull (data);
@@ -827,8 +826,7 @@ fu_engine_device_unlock_func (void)
g_assert (ret);
/* add the hardcoded 'fwupd' metadata */
- filename = fu_test_get_filename (TESTDATADIR, "metadata.xml");
- g_assert (filename != NULL);
+ filename = g_build_filename (TESTDATADIR_SRC, "metadata.xml", NULL);
file = g_file_new_for_path (filename);
ret = xb_builder_source_load_file (source, file,
XB_BUILDER_SOURCE_FLAG_NONE,
@@ -881,8 +879,7 @@ fu_engine_require_hwid_func (void)
g_assert (ret);
/* get generated file as a blob */
- filename = fu_test_get_filename (TESTDATADIR, "missing-hwid/hwid-1.2.3.cab");
- g_assert (filename != NULL);
+ filename = g_build_filename (TESTDATADIR_DST, "missing-hwid", "hwid-1.2.3.cab", NULL);
blob_cab = fu_common_get_contents_bytes (filename, &error);
g_assert_no_error (error);
g_assert (blob_cab != NULL);
@@ -919,7 +916,6 @@ fu_engine_downgrade_func (void)
{
FwupdRelease *rel;
gboolean ret;
- g_autofree gchar *testdatadir = NULL;
g_autoptr(FuDevice) device = fu_device_new ();
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
g_autoptr(GError) error = NULL;
@@ -1003,9 +999,7 @@ fu_engine_downgrade_func (void)
g_assert_no_error (error);
g_assert (ret);
- testdatadir = fu_test_get_filename (TESTDATADIR, ".");
- g_assert (testdatadir != NULL);
- g_setenv ("FU_SELF_TEST_REMOTES_DIR", testdatadir, TRUE);
+ g_setenv ("FU_SELF_TEST_REMOTES_DIR", TESTDATADIR_SRC, TRUE);
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_ENUMERATE, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -1080,7 +1074,6 @@ fu_engine_install_duration_func (void)
{
FwupdRelease *rel;
gboolean ret;
- g_autofree gchar *testdatadir = NULL;
g_autoptr(FuDevice) device = fu_device_new ();
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
g_autoptr(GError) error = NULL;
@@ -1114,9 +1107,7 @@ fu_engine_install_duration_func (void)
g_assert_no_error (error);
g_assert (ret);
- testdatadir = fu_test_get_filename (TESTDATADIR, ".");
- g_assert (testdatadir != NULL);
- g_setenv ("FU_SELF_TEST_REMOTES_DIR", testdatadir, TRUE);
+ g_setenv ("FU_SELF_TEST_REMOTES_DIR", TESTDATADIR_SRC, TRUE);
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_ENUMERATE, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -1151,7 +1142,6 @@ fu_engine_history_func (void)
g_autofree gchar *device_str_expected = NULL;
g_autofree gchar *device_str = NULL;
g_autofree gchar *filename = NULL;
- g_autofree gchar *testdatadir = NULL;
g_autoptr(FuDevice) device2 = NULL;
g_autoptr(FuDevice) device = fu_device_new ();
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
@@ -1179,9 +1169,7 @@ fu_engine_history_func (void)
g_assert (ret);
fu_engine_add_plugin (engine, plugin);
- testdatadir = fu_test_get_filename (TESTDATADIR, ".");
- g_assert (testdatadir != NULL);
- g_setenv ("FU_SELF_TEST_REMOTES_DIR", testdatadir, TRUE);
+ g_setenv ("FU_SELF_TEST_REMOTES_DIR", TESTDATADIR_SRC, TRUE);
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_ENUMERATE, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -1203,8 +1191,7 @@ fu_engine_history_func (void)
g_assert_cmpint (devices->len, ==, 1);
g_assert (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_REGISTERED));
- filename = fu_test_get_filename (TESTDATADIR, "missing-hwid/noreqs-1.2.3.cab");
- g_assert (filename != NULL);
+ filename = g_build_filename (TESTDATADIR_DST, "missing-hwid", "noreqs-1.2.3.cab", NULL);
blob_cab = fu_common_get_contents_bytes (filename, &error);
g_assert_no_error (error);
g_assert (blob_cab != NULL);
@@ -1287,7 +1274,6 @@ fu_engine_history_inherit (void)
{
gboolean ret;
g_autofree gchar *filename = NULL;
- g_autofree gchar *testdatadir = NULL;
g_autoptr(FuDevice) device = fu_device_new ();
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
g_autoptr(FuInstallTask) task = NULL;
@@ -1308,9 +1294,7 @@ fu_engine_history_inherit (void)
g_assert_no_error (error);
g_assert (ret);
fu_engine_add_plugin (engine, plugin);
- testdatadir = fu_test_get_filename (TESTDATADIR, ".");
- g_assert (testdatadir != NULL);
- g_setenv ("FU_SELF_TEST_REMOTES_DIR", testdatadir, TRUE);
+ g_setenv ("FU_SELF_TEST_REMOTES_DIR", TESTDATADIR_SRC, TRUE);
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_ENUMERATE, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -1331,8 +1315,7 @@ fu_engine_history_inherit (void)
g_assert_cmpint (devices->len, ==, 1);
g_assert (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_REGISTERED));
- filename = fu_test_get_filename (TESTDATADIR, "missing-hwid/noreqs-1.2.3.cab");
- g_assert (filename != NULL);
+ filename = g_build_filename (TESTDATADIR_DST, "missing-hwid", "noreqs-1.2.3.cab", NULL);
blob_cab = fu_common_get_contents_bytes (filename, &error);
g_assert_no_error (error);
g_assert (blob_cab != NULL);
@@ -1394,7 +1377,6 @@ fu_engine_history_error_func (void)
g_autofree gchar *device_str_expected = NULL;
g_autofree gchar *device_str = NULL;
g_autofree gchar *filename = NULL;
- g_autofree gchar *testdatadir = NULL;
g_autoptr(FuDevice) device2 = NULL;
g_autoptr(FuDevice) device = fu_device_new ();
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
@@ -1419,9 +1401,7 @@ fu_engine_history_error_func (void)
g_assert (ret);
fu_engine_add_plugin (engine, plugin);
- testdatadir = fu_test_get_filename (TESTDATADIR, ".");
- g_assert (testdatadir != NULL);
- g_setenv ("FU_SELF_TEST_REMOTES_DIR", testdatadir, TRUE);
+ g_setenv ("FU_SELF_TEST_REMOTES_DIR", TESTDATADIR_SRC, TRUE);
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_ENUMERATE, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -1443,8 +1423,7 @@ fu_engine_history_error_func (void)
g_assert (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_REGISTERED));
/* install the wrong thing */
- filename = fu_test_get_filename (TESTDATADIR, "missing-hwid/noreqs-1.2.3.cab");
- g_assert (filename != NULL);
+ filename = g_build_filename (TESTDATADIR_DST, "missing-hwid", "noreqs-1.2.3.cab", NULL);
blob_cab = fu_common_get_contents_bytes (filename, &error);
g_assert_no_error (error);
g_assert (blob_cab != NULL);
@@ -1987,7 +1966,7 @@ fu_history_migrate_func (void)
g_autofree gchar *filename = NULL;
/* load old version */
- filename = fu_test_get_filename (TESTDATADIR, "history_v1.db");
+ filename = g_build_filename (TESTDATADIR_SRC, "history_v1.db", NULL);
file_src = g_file_new_for_path (filename);
file_dst = g_file_new_for_path ("/tmp/fwupd-self-test/var/lib/fwupd/pending.db");
ret = g_file_copy (file_src, file_dst, G_FILE_COPY_OVERWRITE, NULL,
@@ -2091,7 +2070,7 @@ fu_plugin_module_func (void)
g_signal_connect (device, "notify::status",
G_CALLBACK (_plugin_status_changed_cb),
&cnt);
- mapped_file_fn = fu_test_get_filename (TESTDATADIR, "colorhug/firmware.bin");
+ mapped_file_fn = g_build_filename (TESTDATADIR_SRC, "colorhug", "firmware.bin", NULL);
mapped_file = g_mapped_file_new (mapped_file_fn, FALSE, &error);
g_assert_no_error (error);
g_assert (mapped_file != NULL);
@@ -2318,15 +2297,13 @@ fu_keyring_gpg_func (void)
ret = fu_keyring_setup (keyring, &error);
g_assert_no_error (error);
g_assert_true (ret);
- pki_dir = fu_test_get_filename (TESTDATADIR, "pki");
- g_assert_nonnull (pki_dir);
+ pki_dir = g_build_filename (TESTDATADIR_SRC, "pki", NULL);
ret = fu_keyring_add_public_keys (keyring, pki_dir, &error);
g_assert_no_error (error);
g_assert_true (ret);
/* verify with GnuPG */
- fw_pass = fu_test_get_filename (TESTDATADIR, "colorhug/firmware.bin");
- g_assert_nonnull (fw_pass);
+ fw_pass = g_build_filename (TESTDATADIR_SRC, "colorhug", "firmware.bin", NULL);
blob_pass = fu_common_get_contents_bytes (fw_pass, &error);
g_assert_no_error (error);
g_assert_nonnull (blob_pass);
@@ -2341,8 +2318,7 @@ fu_keyring_gpg_func (void)
"3FC6B804410ED0840D8F2F9748A6D80E4538BAC2");
/* verify will fail with GnuPG */
- fw_fail = fu_test_get_filename (TESTDATADIR, "colorhug/colorhug-als-3.0.2.cab");
- g_assert_nonnull (fw_fail);
+ fw_fail = g_build_filename (TESTDATADIR_DST, "colorhug", "colorhug-als-3.0.2.cab", NULL);
blob_fail = fu_common_get_contents_bytes (fw_fail, &error);
g_assert_no_error (error);
g_assert_nonnull (blob_fail);
@@ -2380,20 +2356,17 @@ fu_keyring_pkcs7_func (void)
ret = fu_keyring_setup (keyring, &error);
g_assert_no_error (error);
g_assert_true (ret);
- pki_dir = fu_test_get_filename (TESTDATADIR_SRC, "pki");
- g_assert_nonnull (pki_dir);
+ pki_dir = g_build_filename (TESTDATADIR_SRC, "pki", NULL);
ret = fu_keyring_add_public_keys (keyring, pki_dir, &error);
g_assert_no_error (error);
g_assert_true (ret);
/* verify with a signature from the old LVFS */
- fw_pass = fu_test_get_filename (TESTDATADIR_SRC, "colorhug/firmware.bin");
- g_assert_nonnull (fw_pass);
+ fw_pass = g_build_filename (TESTDATADIR_SRC, "colorhug", "firmware.bin", NULL);
blob_pass = fu_common_get_contents_bytes (fw_pass, &error);
g_assert_no_error (error);
g_assert_nonnull (blob_pass);
- sig_fn = fu_test_get_filename (TESTDATADIR_SRC, "colorhug/firmware.bin.p7b");
- g_assert_nonnull (sig_fn);
+ sig_fn = g_build_filename (TESTDATADIR_SRC, "colorhug", "firmware.bin.p7b", NULL);
blob_sig = fu_common_get_contents_bytes (sig_fn, &error);
g_assert_no_error (error);
g_assert_nonnull (blob_sig);
@@ -2406,8 +2379,7 @@ fu_keyring_pkcs7_func (void)
g_assert_cmpstr (fu_keyring_result_get_authority (result_pass), == , "O=Linux Vendor Firmware Project,CN=LVFS CA");
/* verify will fail with a self-signed signature */
- sig_fn2 = fu_test_get_filename (TESTDATADIR_DST, "colorhug/firmware.bin.p7c");
- g_assert_nonnull (sig_fn2);
+ sig_fn2 = g_build_filename (TESTDATADIR_DST, "colorhug", "firmware.bin.p7c", NULL);
blob_sig2 = fu_common_get_contents_bytes (sig_fn2, &error);
g_assert_no_error (error);
g_assert_nonnull (blob_sig2);
@@ -2418,8 +2390,7 @@ fu_keyring_pkcs7_func (void)
g_clear_error (&error);
/* verify will fail with valid signature and different data */
- fw_fail = fu_test_get_filename (TESTDATADIR, "colorhug/colorhug-als-3.0.2.cab");
- g_assert_nonnull (fw_fail);
+ fw_fail = g_build_filename (TESTDATADIR_DST, "colorhug", "colorhug-als-3.0.2.cab", NULL);
blob_fail = fu_common_get_contents_bytes (fw_fail, &error);
g_assert_no_error (error);
g_assert_nonnull (blob_fail);
diff --git a/src/meson.build b/src/meson.build
index f59722d3a..ac0d526de 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -295,7 +295,6 @@ if get_option('tests')
c_args : [
'-DTESTDATADIR_SRC="' + testdatadir_src + '"',
'-DTESTDATADIR_DST="' + testdatadir_dst + '"',
- '-DTESTDATADIR="' + testdatadir_src + ':' + testdatadir_dst + '"',
'-DPLUGINBUILDDIR="' + pluginbuilddir + '"',
],
)