diff --git a/.gitignore b/.gitignore index ad7502c..87806d5 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ GRTAGS # test suite junk check_core check_files +check_template check_updates *.log diff --git a/Makefile.am b/Makefile.am index 17ffa0d..fd99d36 100644 --- a/Makefile.am +++ b/Makefile.am @@ -153,9 +153,10 @@ manpages_DATA = \ distclean-local: rm -rf ${top_builddir}/tests/update_playground -TESTS = \ - check_core \ - check_files \ +TESTS = \ + check_core \ + check_files \ + check_template \ check_updates check_PROGRAMS = $(TESTS) @@ -194,6 +195,22 @@ check_files_LDADD = \ $(BLKID_LIBS) \ $(CHECK_LIBS) +check_template_SOURCES = \ + tests/check-template.c + +check_template_CFLAGS = \ + $(CRYPTO_CFLAGS) \ + $(BLKID_CFLAGS) \ + $(CHECK_CFLAGS) \ + $(AM_CFLAGS) + +check_template_LDADD = \ + libcbm.la \ + libnica.la \ + $(CRYPTO_LIBS) \ + $(BLKID_LIBS) \ + $(CHECK_LIBS) + check_updates_SOURCES = \ tests/check-updates.c \ tests/harness.h \ diff --git a/tests/check-template.c b/tests/check-template.c new file mode 100644 index 0000000..ed5ee15 --- /dev/null +++ b/tests/check-template.c @@ -0,0 +1,76 @@ +/* + * This file is part of clr-boot-manager. + * + * Copyright © 2016 Intel Corporation + * + * clr-boot-manager 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.1 + * of the License, or (at your option) any later version. + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +#include "util.h" + +#include "template.h" + +START_TEST(bootman_template_test_simple_new) +{ + MstTemplateParser *parser = NULL; + + parser = mst_template_parser_new(); + fail_if(!parser, "Failed to construct new MstTemplateParser"); + mst_template_parser_free(parser); +} +END_TEST + +static Suite *core_suite(void) +{ + Suite *s = NULL; + TCase *tc = NULL; + + s = suite_create("bootman_template"); + tc = tcase_create("bootman_template_simple"); + tcase_add_test(tc, bootman_template_test_simple_new); + suite_add_tcase(s, tc); + + return s; +} + +int main(void) +{ + Suite *s; + SRunner *sr; + int fail; + + s = core_suite(); + sr = srunner_create(s); + srunner_run_all(sr, CK_VERBOSE); + fail = srunner_ntests_failed(sr); + srunner_free(sr); + + if (fail > 0) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=8 tabstop=8 expandtab: + * :indentSize=8:tabSize=8:noTabs=true: + */