Commit 17e08991 authored by Bastien Nocera's avatar Bastien Nocera

build: Make tree-magic tests relative to test list file

So that the directories are relative to the test list file, which we
know the path of, rather than top_srcdir, which we can't get to if we
build with srcdir != builddir.
parent 04f2e23a
......@@ -532,7 +532,8 @@ sniff_content_type (GFile *root)
static gboolean
handle_one_line (const char *line)
handle_one_line (const char *line,
const char *cwd)
GFile *file;
GPtrArray *array;
......@@ -552,7 +553,7 @@ handle_one_line (const char *line)
filename = items[0];
mimetypes = g_strsplit (items[1], " ", -1);
file = g_file_new_for_commandline_arg (filename);
file = g_file_new_for_commandline_arg_and_cwd (filename, cwd);
array = sniff_content_type (file);
if (array->len == 0) {
......@@ -634,7 +635,7 @@ print_matchlet (TreeMatchlet *matchlet, guint depth)
int main (int argc, char **argv)
GError *error = NULL;
char *content, **lines;
char *content, **lines, *cwd;
guint i;
......@@ -678,12 +679,14 @@ int main (int argc, char **argv)
lines = g_strsplit (content, "\n", -1);
g_free (content);
cwd = g_path_get_dirname (argv[1]);
for (i = 0; lines[i] != NULL; i++) {
if (*lines[i] == '\0' || *lines[i] == '#')
if (handle_one_line (lines[i]) == FALSE)
if (handle_one_line (lines[i], cwd) == FALSE)
return 1;
g_free (cwd);
tree_magic_shutdown ();
# Supposed to work
tests/image-dcf x-content/image-dcf
tests/video-vcd x-content/video-vcd
tests/video-svcd x-content/video-svcd
tests/video-dvd x-content/video-dvd x-content/audio-dvd
tests/video-dvd-2 x-content/video-dvd x-content/audio-dvd
tests/video-dvd-3 x-content/video-dvd x-content/audio-dvd
tests/video-bluray x-content/video-bluray
tests/video-hddvd x-content/video-hddvd
tests/image-picturecd x-content/image-picturecd
tests/software x-content/unix-software
image-dcf x-content/image-dcf
video-vcd x-content/video-vcd
video-svcd x-content/video-svcd
video-dvd x-content/video-dvd x-content/audio-dvd
video-dvd-2 x-content/video-dvd x-content/audio-dvd
video-dvd-3 x-content/video-dvd x-content/audio-dvd
video-bluray x-content/video-bluray
video-hddvd x-content/video-hddvd
image-picturecd x-content/image-picturecd
software x-content/unix-software
# Supposed to fail
x tests x-content/image-dcf
x tree-failure x-content/image-dcf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment