mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
tests: make test tool system independent
We don't want to rely on host /proc/mounts or we cannot really test this on machines other than the target failure.
This commit is contained in:
@ -30,29 +30,29 @@ main (gint argc,
|
||||
g_autofree gchar *lookup = NULL;
|
||||
gsize len;
|
||||
|
||||
if (argc != 3)
|
||||
if (argc != 4)
|
||||
{
|
||||
g_printerr ("usage: %s MOUNTINFO_FILE PATH_TO_TRANSLATE\n", argv[0]);
|
||||
g_printerr ("usage: %s MOUNTS MOUNTINFO_FILE PATH_TO_TRANSLATE\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
info = sysprof_mountinfo_new ();
|
||||
|
||||
if (!g_file_get_contents ("/proc/mounts", &contents, &len, &error))
|
||||
if (!g_file_get_contents (argv[1], &contents, &len, &error))
|
||||
g_error ("%s", error->message);
|
||||
sysprof_mountinfo_parse_mounts (info, contents);
|
||||
g_free (g_steal_pointer (&contents));
|
||||
|
||||
if (!g_file_get_contents (argv[1], &contents, &len, &error))
|
||||
if (!g_file_get_contents (argv[2], &contents, &len, &error))
|
||||
g_error ("%s", error->message);
|
||||
sysprof_mountinfo_parse_mountinfo (info, contents);
|
||||
|
||||
lookup = sysprof_mountinfo_translate (info, argv[2]);
|
||||
lookup = sysprof_mountinfo_translate (info, argv[3]);
|
||||
|
||||
if (lookup)
|
||||
g_print ("%s\n", lookup);
|
||||
else
|
||||
g_print ("%s\n", argv[2]);
|
||||
g_print ("%s\n", argv[3]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user