mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-03 05:18:24 +03:00
ebd0370976
I want to be able to easily test the C API on actual data in an OSTree repo. The shell `libtest.sh` has code to generate it. Bridge the two worlds by introducing a little `libostreetest` library which has a C API which spawns a shell that runs things in `libtest.sh`. Yes, this is about as beautiful as it sounds, which is to say, it's not. But it works! Note while we were here, I realized we were actually now creating *two* tmpdirs per test in `make check` because the tap driver was already doing that. Unify it so we know the C code can rely on it.
55 lines
1.5 KiB
C
55 lines
1.5 KiB
C
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
|
*
|
|
* Copyright (C) 2016 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdlib.h>
|
|
#include <gio/gio.h>
|
|
#include <string.h>
|
|
|
|
#include "libglnx.h"
|
|
#include "libostreetest.h"
|
|
|
|
static void
|
|
test_repo_is_not_system (gconstpointer data)
|
|
{
|
|
OtTest *self = (void*)data;
|
|
g_assert (!ostree_repo_is_system (self->repo));
|
|
}
|
|
|
|
int main (int argc, char **argv)
|
|
{
|
|
g_autoptr(GError) error = NULL;
|
|
OtTest selfd = {NULL,};
|
|
|
|
g_test_init (&argc, &argv, NULL);
|
|
|
|
if (!ot_test_setup_repo (&selfd, NULL, &error))
|
|
goto out;
|
|
|
|
g_test_add_data_func ("/repo-not-system", &selfd, test_repo_is_not_system);
|
|
|
|
return g_test_run();
|
|
out:
|
|
if (error)
|
|
g_error ("%s", error->message);
|
|
return 1;
|
|
}
|