|
rpm-build |
0fba15 |
/*
|
|
rpm-build |
0fba15 |
* Copyright (C) 2016 Red Hat, Inc.
|
|
rpm-build |
0fba15 |
*
|
|
rpm-build |
0fba15 |
* SPDX-License-Identifier: LGPL-2.0+
|
|
rpm-build |
0fba15 |
*
|
|
rpm-build |
0fba15 |
* This library is free software; you can redistribute it and/or
|
|
rpm-build |
0fba15 |
* modify it under the terms of the GNU Lesser General Public
|
|
rpm-build |
0fba15 |
* License as published by the Free Software Foundation; either
|
|
rpm-build |
0fba15 |
* version 2 of the License, or (at your option) any later version.
|
|
rpm-build |
0fba15 |
*
|
|
rpm-build |
0fba15 |
* This library is distributed in the hope that it will be useful,
|
|
rpm-build |
0fba15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
rpm-build |
0fba15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
rpm-build |
0fba15 |
* Lesser General Public License for more details.
|
|
rpm-build |
0fba15 |
*
|
|
rpm-build |
0fba15 |
* You should have received a copy of the GNU Lesser General Public
|
|
rpm-build |
0fba15 |
* License along with this library; if not, write to the
|
|
rpm-build |
0fba15 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
rpm-build |
0fba15 |
* Boston, MA 02111-1307, USA.
|
|
rpm-build |
0fba15 |
*/
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
#include "config.h"
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
#include <stdlib.h>
|
|
rpm-build |
0fba15 |
#include <gio/gio.h>
|
|
rpm-build |
0fba15 |
#include <string.h>
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
#include "libglnx.h"
|
|
rpm-build |
0fba15 |
#include "libostreetest.h"
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
static gboolean
|
|
rpm-build |
0fba15 |
run_sync (const char *cmdline, GError **error)
|
|
rpm-build |
0fba15 |
{
|
|
rpm-build |
0fba15 |
int estatus;
|
|
rpm-build |
0fba15 |
if (!g_spawn_command_line_sync (cmdline, NULL, NULL, &estatus, error))
|
|
rpm-build |
0fba15 |
return FALSE;
|
|
rpm-build |
0fba15 |
if (!g_spawn_check_exit_status (estatus, error))
|
|
rpm-build |
0fba15 |
return FALSE;
|
|
rpm-build |
0fba15 |
return TRUE;
|
|
rpm-build |
0fba15 |
}
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
static void
|
|
rpm-build |
0fba15 |
test_sysroot_reload (gconstpointer data)
|
|
rpm-build |
0fba15 |
{
|
|
rpm-build |
0fba15 |
OstreeSysroot *sysroot = (void*)data;
|
|
rpm-build |
0fba15 |
g_autoptr(GError) error = NULL;
|
|
rpm-build |
0fba15 |
gboolean changed;
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
if (!ostree_sysroot_load (sysroot, NULL, &error))
|
|
rpm-build |
0fba15 |
goto out;
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
if (!ostree_sysroot_load_if_changed (sysroot, &changed, NULL, &error))
|
|
rpm-build |
0fba15 |
goto out;
|
|
rpm-build |
0fba15 |
g_assert (!changed);
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
if (!run_sync ("ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime", &error))
|
|
rpm-build |
0fba15 |
goto out;
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
if (!run_sync ("ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime", &error))
|
|
rpm-build |
0fba15 |
goto out;
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
if (!ostree_sysroot_load_if_changed (sysroot, &changed, NULL, &error))
|
|
rpm-build |
0fba15 |
goto out;
|
|
rpm-build |
0fba15 |
g_assert (changed);
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
if (!ostree_sysroot_load_if_changed (sysroot, &changed, NULL, &error))
|
|
rpm-build |
0fba15 |
goto out;
|
|
rpm-build |
0fba15 |
g_assert (!changed);
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
out:
|
|
rpm-build |
0fba15 |
if (error)
|
|
rpm-build |
0fba15 |
g_error ("%s", error->message);
|
|
rpm-build |
0fba15 |
}
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
int main (int argc, char **argv)
|
|
rpm-build |
0fba15 |
{
|
|
rpm-build |
0fba15 |
g_autoptr(GError) error = NULL;
|
|
rpm-build |
0fba15 |
glnx_unref_object OstreeSysroot *sysroot = NULL;
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
g_test_init (&argc, &argv, NULL);
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
sysroot = ot_test_setup_sysroot (NULL, &error);
|
|
rpm-build |
0fba15 |
if (!sysroot)
|
|
rpm-build |
0fba15 |
goto out;
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
g_test_add_data_func ("/sysroot-reload", sysroot, test_sysroot_reload);
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
return g_test_run();
|
|
rpm-build |
0fba15 |
out:
|
|
rpm-build |
0fba15 |
if (error)
|
|
rpm-build |
0fba15 |
g_error ("%s", error->message);
|
|
rpm-build |
0fba15 |
return 1;
|
|
rpm-build |
0fba15 |
}
|