diff options
Diffstat (limited to 'tests')
48 files changed, 1525 insertions, 0 deletions
diff --git a/tests/api/oom.h b/tests/api/oom.h new file mode 100644 index 000000000000..2d3818c86b52 --- /dev/null +++ b/tests/api/oom.h @@ -0,0 +1,59 @@ +/* + * oom.h + * Exhaustive allocation-failure test driver, built on the fuzzer/alloc-inject + * fault injector. + * + * SPDX-License-Identifier: pkgconf + * + * Copyright (c) 2026 pkgconf authors (see AUTHORS). + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * This software is provided 'as is' and without any warranty, express or + * implied. In no event shall the authors be liable for any damages arising + * from the use of this software. + */ + +#ifndef TEST_API_OOM_H +#define TEST_API_OOM_H + +#include "test-api.h" +#include "alloc-inject.h" + +/* + * Exhaustively fail each successive allocation an expression makes until it can + * complete with none failing. Every injected failure must be reported + * gracefully (NULL for OOM_TEST_PTR, false for OOM_TEST_BOOL); on the run where + * no allocation fails the value succeeds and the loop ends. Under ASAN this + * also asserts each partial-construction error path leaks nothing. + */ +#define OOM_TEST_PTR(objvar, make_expr, free_stmt) \ + do { \ + for (unsigned long _oom_n = 1; ; _oom_n++) \ + { \ + alloc_inject_arm(_oom_n); \ + (objvar) = (make_expr); \ + bool _oom_f = alloc_inject_fired(); \ + alloc_inject_disarm(); \ + if (!_oom_f) { free_stmt; break; } \ + TEST_ASSERT_NULL(objvar); \ + free_stmt; \ + } \ + } while (0) + +#define OOM_TEST_BOOL(make_expr) \ + do { \ + for (unsigned long _oom_n = 1; ; _oom_n++) \ + { \ + alloc_inject_arm(_oom_n); \ + bool _oom_ok = (make_expr); \ + bool _oom_f = alloc_inject_fired(); \ + alloc_inject_disarm(); \ + if (!_oom_f) { TEST_ASSERT_TRUE(_oom_ok); break; } \ + TEST_ASSERT_FALSE(_oom_ok); \ + } \ + } while (0) + +#endif // TEST_API_OOM_H diff --git a/tests/api/test-oom-spdxtool.c b/tests/api/test-oom-spdxtool.c new file mode 100644 index 000000000000..aa3b36c1c013 --- /dev/null +++ b/tests/api/test-oom-spdxtool.c @@ -0,0 +1,160 @@ +/* + * test-oom.c + * Allocation-failure (OOM) tests for spdxtool, using the oom.h injection + * harness. For each target, a failure is injected at every successive + * allocation; the target must report the error gracefully (NULL) and, under + * ASAN, leak nothing on the error path. + * + * SPDX-License-Identifier: pkgconf + * + * Copyright (c) 2026 pkgconf authors (see AUTHORS). + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * This software is provided 'as is' and without any warranty, express or + * implied. In no event shall the authors be liable for any damages arising + * from the use of this software. + */ + +#include <libpkgconf/stdinc.h> +#include <libpkgconf/libpkgconf.h> +#include "oom.h" +#include "core.h" +#include "software.h" +#include "simplelicensing.h" +#include "serialize.h" +#include "util.h" + +static pkgconf_client_t *g_client; + +static void +oom_setup(void) +{ + g_client = test_client_new(); + // Mirror cli/spdxtool/main.c: the constructors read these globals + spdxtool_util_set_uri_root(g_client, "https://example.com/test"); + spdxtool_util_set_uri_separator_colon(g_client, false); + spdxtool_util_set_spdx_version(g_client, "3.0.1"); + spdxtool_util_set_spdx_license(g_client, "CC0-1.0"); +} + +/* + * ============================================== + * core / software / simplelicensing constructors + * ============================================== + */ + +static void +test_oom_agent_new(void) +{ + spdxtool_core_agent_t *a; + OOM_TEST_PTR(a, spdxtool_core_agent_new(g_client, "_:c1", "Agent Name"), spdxtool_core_agent_free(a)); +} + +static void +test_oom_creation_info_new(void) +{ + spdxtool_core_creation_info_t *c; + // NULL time exercises the get_current_iso8601_time() strdup path too + OOM_TEST_PTR(c, spdxtool_core_creation_info_new(g_client, "agentid", "_:c1", NULL), + spdxtool_core_creation_info_free(c)); +} + +static void +test_oom_spdx_document_new(void) +{ + spdxtool_core_spdx_document_t *d; + OOM_TEST_PTR(d, spdxtool_core_spdx_document_new(g_client, "docid", "_:c1", "agentid"), + spdxtool_core_spdx_document_free(d)); +} + +static void +test_oom_sbom_new(void) +{ + spdxtool_software_sbom_t *s; + OOM_TEST_PTR(s, spdxtool_software_sbom_new(g_client, "sbomid", "_:c1", "build"), spdxtool_software_sbom_free(s)); +} + +static void +test_oom_license_expression_new(void) +{ + spdxtool_simplelicensing_license_expression_t *e; + OOM_TEST_PTR(e, spdxtool_simplelicensing_licenseExpression_new(g_client, "MIT"), + spdxtool_simplelicensing_licenseExpression_free(e)); +} + +/* + * ====================== + * serializer value model + * ====================== + */ + +static void +test_oom_serialize_constructors(void) +{ + spdxtool_serialize_object_list_t *o; + OOM_TEST_PTR(o, spdxtool_serialize_object_list_new(), spdxtool_serialize_object_list_free(o)); + + spdxtool_serialize_array_t *a; + OOM_TEST_PTR(a, spdxtool_serialize_array_new(), spdxtool_serialize_array_free(a)); + + spdxtool_serialize_value_t *v; + OOM_TEST_PTR(v, spdxtool_serialize_value_string("hello"), spdxtool_serialize_value_free(v)); + OOM_TEST_PTR(v, spdxtool_serialize_value_int(7), spdxtool_serialize_value_free(v)); + OOM_TEST_PTR(v, spdxtool_serialize_value_bool(true), spdxtool_serialize_value_free(v)); + OOM_TEST_PTR(v, spdxtool_serialize_value_null(), spdxtool_serialize_value_free(v)); +} + +/* + * ============================================================ + * *_to_object serializers that depend only on their own struct + * ============================================================ + */ + +static void +test_oom_to_object(void) +{ + spdxtool_serialize_value_t *v; + + spdxtool_core_agent_t *agent = spdxtool_core_agent_new(g_client, "_:c1", "Agent"); + TEST_ASSERT_NONNULL(agent); + OOM_TEST_PTR(v, spdxtool_core_agent_to_object(g_client, agent), + spdxtool_serialize_value_free(v)); + spdxtool_core_agent_free(agent); + + spdxtool_core_creation_info_t *ci = + spdxtool_core_creation_info_new(g_client, "agentid", "_:c1", "2020-01-01T00:00:00Z"); + TEST_ASSERT_NONNULL(ci); + OOM_TEST_PTR(v, spdxtool_core_creation_info_to_object(g_client, ci), + spdxtool_serialize_value_free(v)); + spdxtool_core_creation_info_free(ci); + + spdxtool_simplelicensing_license_expression_t *le = + spdxtool_simplelicensing_licenseExpression_new(g_client, "MIT"); + TEST_ASSERT_NONNULL(le); + OOM_TEST_PTR(v, spdxtool_simplelicensing_licenseExpression_to_object(g_client, "_:c1", le), + spdxtool_serialize_value_free(v)); + spdxtool_simplelicensing_licenseExpression_free(le); +} + +int +main(int argc, const char **argv) +{ + (void) argc; + const char *basename = pkgconf_path_find_basename(argv[0]); + + oom_setup(); + + TEST_RUN(basename, test_oom_agent_new); + TEST_RUN(basename, test_oom_creation_info_new); + TEST_RUN(basename, test_oom_spdx_document_new); + TEST_RUN(basename, test_oom_sbom_new); + TEST_RUN(basename, test_oom_license_expression_new); + TEST_RUN(basename, test_oom_serialize_constructors); + TEST_RUN(basename, test_oom_to_object); + + pkgconf_client_free(g_client); + return EXIT_SUCCESS; +} diff --git a/tests/api/test-path-utils.c b/tests/api/test-path-utils.c index 519cadb6f639..029f03b052a5 100644 --- a/tests/api/test-path-utils.c +++ b/tests/api/test-path-utils.c @@ -105,6 +105,154 @@ test_determine_prefix_logic(void) pkgconf_buffer_finalize(&buf); } +static const char * +nth_path(const pkgconf_list_t *list, size_t idx) +{ + pkgconf_node_t *n; + size_t i = 0; + + PKGCONF_FOREACH_LIST_ENTRY(list->head, n) + { + const pkgconf_path_t *p = n->data; + + if (i++ == idx) + return p->path; + } + + return NULL; +} + +static void +test_path_prepend(void) +{ + pkgconf_list_t list = PKGCONF_LIST_INITIALIZER; + + pkgconf_path_prepend("/a", &list, false); + pkgconf_path_prepend("/b", &list, false); + pkgconf_path_prepend("/c", &list, false); + + TEST_ASSERT_EQ(list.length, 3); + TEST_ASSERT_STRCMP_EQ(nth_path(&list, 0), "/c"); + TEST_ASSERT_STRCMP_EQ(nth_path(&list, 1), "/b"); + TEST_ASSERT_STRCMP_EQ(nth_path(&list, 2), "/a"); + + pkgconf_path_add("/d", &list, false); + TEST_ASSERT_EQ(list.length, 4); + TEST_ASSERT_STRCMP_EQ(nth_path(&list, 0), "/c"); + TEST_ASSERT_STRCMP_EQ(nth_path(&list, 3), "/d"); + + pkgconf_path_prepend("/e//f", &list, false); + TEST_ASSERT_STRCMP_EQ(nth_path(&list, 0), "/e/f"); + + pkgconf_path_free(&list); + TEST_ASSERT_EQ(list.length, 0); + TEST_ASSERT_NULL(list.head); + TEST_ASSERT_NULL(list.tail); +} + +static void +test_path_prepend_filter(void) +{ + pkgconf_list_t list = PKGCONF_LIST_INITIALIZER; + + pkgconf_path_prepend(".", &list, true); + TEST_ASSERT_EQ(list.length, 1); + + pkgconf_path_prepend(".", &list, true); + TEST_ASSERT_EQ(list.length, 1); + + pkgconf_path_prepend("..", &list, true); + TEST_ASSERT_EQ(list.length, 2); + + pkgconf_path_prepend(".", &list, false); + TEST_ASSERT_EQ(list.length, 3); + + pkgconf_path_free(&list); +} + +static void +test_path_prepend_list(void) +{ + pkgconf_list_t src = PKGCONF_LIST_INITIALIZER; + pkgconf_list_t dst = PKGCONF_LIST_INITIALIZER; + + pkgconf_path_add("/s1", &src, false); + pkgconf_path_add("/s2", &src, false); + pkgconf_path_add("/s3", &src, false); + + pkgconf_path_add("/d1", &dst, false); + pkgconf_path_add("/d2", &dst, false); + + pkgconf_path_prepend_list(&dst, &src); + + TEST_ASSERT_EQ(dst.length, 5); + TEST_ASSERT_STRCMP_EQ(nth_path(&dst, 0), "/s3"); + TEST_ASSERT_STRCMP_EQ(nth_path(&dst, 1), "/s2"); + TEST_ASSERT_STRCMP_EQ(nth_path(&dst, 2), "/s1"); + TEST_ASSERT_STRCMP_EQ(nth_path(&dst, 3), "/d1"); + TEST_ASSERT_STRCMP_EQ(nth_path(&dst, 4), "/d2"); + + TEST_ASSERT_EQ(src.length, 3); + TEST_ASSERT_STRCMP_EQ(nth_path(&src, 0), "/s1"); + TEST_ASSERT_TRUE(nth_path(&dst, 2) != nth_path(&src, 0)); + + pkgconf_path_free(&dst); + TEST_ASSERT_EQ(dst.length, 0); + + TEST_ASSERT_EQ(src.length, 3); + TEST_ASSERT_STRCMP_EQ(nth_path(&src, 2), "/s3"); + + pkgconf_path_prepend_list(&dst, &src); + TEST_ASSERT_EQ(dst.length, 3); + TEST_ASSERT_STRCMP_EQ(nth_path(&dst, 0), "/s3"); + TEST_ASSERT_STRCMP_EQ(nth_path(&dst, 2), "/s1"); + + pkgconf_path_free(&src); + pkgconf_path_free(&dst); +} + +static bool +plausible(const char *text) +{ + pkgconf_buffer_t buf = PKGCONF_BUFFER_INITIALIZER; + bool result; + + pkgconf_buffer_append(&buf, text); + result = pkgconf_path_is_plausible(&buf); + pkgconf_buffer_finalize(&buf); + + return result; +} + +static void +test_path_is_plausible(void) +{ + pkgconf_buffer_t empty = PKGCONF_BUFFER_INITIALIZER; + + TEST_ASSERT_FALSE(pkgconf_path_is_plausible(NULL)); + TEST_ASSERT_FALSE(pkgconf_path_is_plausible(&empty)); + pkgconf_buffer_finalize(&empty); + + TEST_ASSERT_FALSE(plausible("")); + TEST_ASSERT_FALSE(plausible(" ")); + TEST_ASSERT_FALSE(plausible("libfoo")); + TEST_ASSERT_FALSE(plausible("foo bar")); + TEST_ASSERT_FALSE(plausible(".")); + TEST_ASSERT_FALSE(plausible("..")); + + TEST_ASSERT_TRUE(plausible("/usr/lib/pkgconfig")); + TEST_ASSERT_TRUE(plausible(" /usr/lib")); + TEST_ASSERT_TRUE(plausible("./foo")); + TEST_ASSERT_TRUE(plausible("../foo")); + TEST_ASSERT_TRUE(plausible(".\\foo")); + TEST_ASSERT_TRUE(plausible("..\\foo")); + TEST_ASSERT_TRUE(plausible("C:/foo")); + TEST_ASSERT_TRUE(plausible("C:\\foo")); + TEST_ASSERT_TRUE(plausible("relative/path")); + TEST_ASSERT_TRUE(plausible("relative\\path")); + TEST_ASSERT_TRUE(plausible("Program Files/MySDK")); +} + int main(int argc, char *argv[]) { @@ -114,6 +262,10 @@ main(int argc, char *argv[]) TEST_RUN(basename, test_path_find_basename); TEST_RUN(basename, test_path_trim_basename); TEST_RUN(basename, test_determine_prefix_logic); + TEST_RUN(basename, test_path_prepend); + TEST_RUN(basename, test_path_prepend_filter); + TEST_RUN(basename, test_path_prepend_list); + TEST_RUN(basename, test_path_is_plausible); return EXIT_SUCCESS; } diff --git a/tests/api/test-personality.c b/tests/api/test-personality.c new file mode 100644 index 000000000000..11d44854411d --- /dev/null +++ b/tests/api/test-personality.c @@ -0,0 +1,187 @@ +/* + * test-personality.c + * Tests for libpkgconf personality functions. + * + * SPDX-License-Identifier: pkgconf + * + * Copyright (c) 2026 pkgconf authors (see AUTHORS). + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * This software is provided 'as is' and without any warranty, express or + * implied. In no event shall the authors be liable for any damages arising + * from the use of this software. + */ + +#include "test-api.h" + +static void +test_personality_deinit_null(void) +{ + // Should not crash + pkgconf_cross_personality_deinit(NULL); +} + +static void +test_personality_default_refcount(void) +{ + pkgconf_cross_personality_t *p1 = pkgconf_cross_personality_default(); + pkgconf_cross_personality_t *p2 = pkgconf_cross_personality_default(); + + TEST_ASSERT_NONNULL(p1); + TEST_ASSERT_NONNULL(p2); + // Both calls must return the same singleton pointer + TEST_ASSERT_EQ((long long)(uintptr_t)p1, (long long)(uintptr_t)p2); + + // Refcount is 2 -> first deinit drops it to 1, must not free + pkgconf_cross_personality_deinit(p1); + // Refcount is 1 -> second deinit drops to 0, frees internal state + pkgconf_cross_personality_deinit(p2); + + // Re-initialise from scratch + pkgconf_cross_personality_t *p3 = pkgconf_cross_personality_default(); + TEST_ASSERT_NONNULL(p3); + pkgconf_cross_personality_deinit(p3); +} + +#ifndef PKGCONF_LITE + +static void +test_personality_find_invalid_triplet(void) +{ + /* "bad triplet!" has a space and '!' — both rejected by valid_triplet, + * and the direct-file open will also fail, so result must be NULL. */ + pkgconf_cross_personality_t *p = pkgconf_cross_personality_find("bad triplet!"); + TEST_ASSERT_NULL(p); +} + +static void +test_personality_find_direct_path(void) +{ + char path[] = "test-personality-XXXXXX"; + int fd = mkstemp(path); + TEST_ASSERT_TRUE(fd >= 0); + + FILE *f = fdopen(fd, "w"); + TEST_ASSERT_NONNULL(f); + + fprintf(f, + "Triplet: x86_64-linux-musl\n" + "DefaultSearchPaths: /usr/lib/pkgconfig:/usr/share/pkgconfig\n" + "SysrootDir: /opt/sysroot\n" + "SystemIncludePaths: /opt/sysroot/usr/include\n" + "SystemLibraryPaths: /opt/sysroot/usr/lib\n" + "WantDefaultStatic: true\n" + "WantDefaultPure: yes\n"); + fclose(f); + + pkgconf_cross_personality_t *p = pkgconf_cross_personality_find(path); + TEST_ASSERT_NONNULL(p); + TEST_ASSERT_STRCMP_EQ(p->name, "x86_64-linux-musl"); + TEST_ASSERT_NONNULL(p->sysroot_dir); + TEST_ASSERT_STRCMP_EQ(p->sysroot_dir, "/opt/sysroot"); + TEST_ASSERT_TRUE(p->want_default_static); + TEST_ASSERT_TRUE(p->want_default_pure); + TEST_ASSERT_NONNULL(p->dir_list.head); + + // Exercises the non-default free path + pkgconf_cross_personality_deinit(p); + unlink(path); +} + +#if !defined(_WIN32) && !defined(__HAIKU__) + +static void +test_personality_find_via_xdg(void) +{ + char tmpdir[] = "test-personality-xdg-XXXXXX"; + char *d = mkdtemp(tmpdir); + TEST_ASSERT_NONNULL(d); + + // build: <tmpdir>/pkgconfig/personality.d/ + char pkgconfig_dir[4096]; + char personality_d[4096]; + char file_path[4096]; + + snprintf(pkgconfig_dir, sizeof pkgconfig_dir, "%s/pkgconfig", tmpdir); + snprintf(personality_d, sizeof personality_d, "%s/pkgconfig/personality.d", tmpdir); + snprintf(file_path, sizeof file_path, "%s/pkgconfig/personality.d/xdg-test-triplet.personality", tmpdir); + + TEST_ASSERT_EQ(mkdir(pkgconfig_dir, 0755), 0); + TEST_ASSERT_EQ(mkdir(personality_d, 0755), 0); + + FILE *f = fopen(file_path, "w"); + TEST_ASSERT_NONNULL(f); + fprintf(f, "SysrootDir: /xdg/sysroot\n"); + fclose(f); + + setenv("XDG_DATA_HOME", tmpdir, 1); + + pkgconf_cross_personality_t *p = pkgconf_cross_personality_find("xdg-test-triplet"); + TEST_ASSERT_NONNULL(p); + TEST_ASSERT_NONNULL(p->sysroot_dir); + TEST_ASSERT_STRCMP_EQ(p->sysroot_dir, "/xdg/sysroot"); + + // Verify it is NOT the default singleton + pkgconf_cross_personality_t *def = pkgconf_cross_personality_default(); + TEST_ASSERT_NE((long long)(uintptr_t)p, (long long)(uintptr_t)def); + // Balance the _default() call above + pkgconf_cross_personality_deinit(def); + + // Clean up + pkgconf_cross_personality_deinit(p); + unsetenv("XDG_DATA_HOME"); + + unlink(file_path); + rmdir(personality_d); + rmdir(pkgconfig_dir); + rmdir(tmpdir); +} + +#endif // !_WIN32 && !__HAIKU__ + +static void +test_personality_find_missing_returns_default(void) +{ + // clear XDG / HOME so search goes to known-empty places + unsetenv("XDG_DATA_HOME"); + unsetenv("XDG_DATA_DIRS"); + unsetenv("HOME"); + + pkgconf_cross_personality_t *found = pkgconf_cross_personality_find("nonexistent-triplet-xyzzy"); + TEST_ASSERT_NONNULL(found); + + // The find internally called _default(); call it ourselves to compare + pkgconf_cross_personality_t *def = pkgconf_cross_personality_default(); + TEST_ASSERT_EQ((long long)(uintptr_t)found, (long long)(uintptr_t)def); + + // Two deinits: one for find's internal _default(), one for ours above + pkgconf_cross_personality_deinit(found); + pkgconf_cross_personality_deinit(def); +} + +#endif /* !PKGCONF_LITE */ + +int +main(int argc, char *argv[]) +{ + (void) argc; + const char *basename = pkgconf_path_find_basename(argv[0]); + + // refcount test must run first so the singleton starts at 0 + TEST_RUN(basename, test_personality_deinit_null); + TEST_RUN(basename, test_personality_default_refcount); + +#ifndef PKGCONF_LITE + TEST_RUN(basename, test_personality_find_invalid_triplet); + TEST_RUN(basename, test_personality_find_direct_path); +#if !defined(_WIN32) && !defined(__HAIKU__) + TEST_RUN(basename, test_personality_find_via_xdg); +#endif + TEST_RUN(basename, test_personality_find_missing_returns_default); +#endif + + return EXIT_SUCCESS; +} diff --git a/tests/api/test-queue.c b/tests/api/test-queue.c new file mode 100644 index 000000000000..e18903c2fd9d --- /dev/null +++ b/tests/api/test-queue.c @@ -0,0 +1,250 @@ +/* + * test-queue.c + * Tests for the public libpkgconf queue API. + * + * SPDX-License-Identifier: pkgconf + * + * Copyright (c) 2026 pkgconf authors (see AUTHORS). + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * This software is provided 'as is' and without any warranty, express or + * implied. In no event shall the authors be liable for any damages arising + * from the use of this software. + */ + +#include "test-api.h" + +#define FIXTURE_DIR "test-queue-pcdir" + +static void +write_pc(const char *name, const char *contents) +{ + char path[512]; + FILE *f; + + snprintf(path, sizeof path, "%s/%s", FIXTURE_DIR, name); + f = fopen(path, "wb"); + TEST_ASSERT_NONNULL(f); + fwrite(contents, 1, strlen(contents), f); + fclose(f); +} + +static void +setup_fixtures(void) +{ + mkdir(FIXTURE_DIR, 0755); + write_pc("qbar.pc", "Name: qbar\nDescription: bar\nVersion: 2.0\n"); + write_pc("qfoo.pc", + "Name: qfoo\nDescription: foo\nVersion: 1.0\nRequires: qbar >= 1.0\n"); +} + +static void +teardown_fixtures(void) +{ + remove(FIXTURE_DIR "/qfoo.pc"); + remove(FIXTURE_DIR "/qbar.pc"); + rmdir(FIXTURE_DIR); +} + +static pkgconf_client_t * +fixture_client(void) +{ + pkgconf_client_t *client = test_client_new(); + + pkgconf_path_free(&client->dir_list); + pkgconf_path_add(FIXTURE_DIR, &client->dir_list, false); + + return client; +} + +static size_t +required_count(const pkgconf_pkg_t *world) +{ + size_t n = 0; + const pkgconf_node_t *iter; + + PKGCONF_FOREACH_LIST_ENTRY(world->required.head, iter) + { + n++; + } + + return n; +} + +static bool +contains_dep(const pkgconf_pkg_t *world, const char *name) +{ + const pkgconf_node_t *iter; + + PKGCONF_FOREACH_LIST_ENTRY(world->required.head, iter) + { + const pkgconf_dependency_t *dep = iter->data; + + if (!strcmp(dep->package, name)) + return true; + } + + return false; +} + +static void +test_queue_validate_success(void) +{ + pkgconf_client_t *client = fixture_client(); + pkgconf_list_t queue = PKGCONF_LIST_INITIALIZER; + + pkgconf_queue_push(&queue, "qfoo"); + TEST_ASSERT_TRUE(pkgconf_queue_validate(client, &queue, -1)); + + pkgconf_queue_free(&queue); + pkgconf_client_free(client); +} + +static void +test_queue_validate_version_satisfied(void) +{ + pkgconf_client_t *client = fixture_client(); + pkgconf_list_t queue = PKGCONF_LIST_INITIALIZER; + + pkgconf_queue_push(&queue, "qbar >= 1.0"); + TEST_ASSERT_TRUE(pkgconf_queue_validate(client, &queue, -1)); + + pkgconf_queue_free(&queue); + pkgconf_client_free(client); +} + +static void +test_queue_validate_missing_package(void) +{ + pkgconf_client_t *client = fixture_client(); + pkgconf_list_t queue = PKGCONF_LIST_INITIALIZER; + + pkgconf_queue_push(&queue, "does-not-exist"); + TEST_ASSERT_FALSE(pkgconf_queue_validate(client, &queue, -1)); + + pkgconf_queue_free(&queue); + pkgconf_client_free(client); +} + +static void +test_queue_validate_unsatisfiable_version(void) +{ + pkgconf_client_t *client = fixture_client(); + pkgconf_list_t queue = PKGCONF_LIST_INITIALIZER; + + pkgconf_queue_push(&queue, "qbar >= 99.0"); + TEST_ASSERT_FALSE(pkgconf_queue_validate(client, &queue, -1)); + + pkgconf_queue_free(&queue); + pkgconf_client_free(client); +} + +static void +test_queue_validate_empty(void) +{ + pkgconf_client_t *client = fixture_client(); + pkgconf_list_t queue = PKGCONF_LIST_INITIALIZER; + + TEST_ASSERT_FALSE(pkgconf_queue_validate(client, &queue, -1)); + + pkgconf_queue_free(&queue); + pkgconf_client_free(client); +} + +struct apply_state { + int calls; + size_t deps; + bool saw_qfoo; + bool saw_qbar; + bool retval; +}; + +static bool +apply_cb(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth) +{ + struct apply_state *st = data; + + (void) client; + (void) maxdepth; + + st->calls++; + st->deps = required_count(world); + st->saw_qfoo = contains_dep(world, "qfoo"); + st->saw_qbar = contains_dep(world, "qbar"); + + return st->retval; +} + +static void +test_queue_apply_success(void) +{ + pkgconf_client_t *client = fixture_client(); + pkgconf_list_t queue = PKGCONF_LIST_INITIALIZER; + struct apply_state st = { .retval = true }; + + pkgconf_queue_push(&queue, "qfoo"); + TEST_ASSERT_TRUE(pkgconf_queue_apply(client, &queue, apply_cb, -1, &st)); + + TEST_ASSERT_EQ(st.calls, 1); + TEST_ASSERT_GE(st.deps, 2); + TEST_ASSERT_TRUE(st.saw_qfoo); + TEST_ASSERT_TRUE(st.saw_qbar); + + pkgconf_queue_free(&queue); + pkgconf_client_free(client); +} + +static void +test_queue_apply_callback_failure(void) +{ + pkgconf_client_t *client = fixture_client(); + pkgconf_list_t queue = PKGCONF_LIST_INITIALIZER; + struct apply_state st = { .retval = false }; + + pkgconf_queue_push(&queue, "qfoo"); + TEST_ASSERT_FALSE(pkgconf_queue_apply(client, &queue, apply_cb, -1, &st)); + TEST_ASSERT_EQ(st.calls, 1); + + pkgconf_queue_free(&queue); + pkgconf_client_free(client); +} + +static void +test_queue_apply_missing_package(void) +{ + pkgconf_client_t *client = fixture_client(); + pkgconf_list_t queue = PKGCONF_LIST_INITIALIZER; + struct apply_state st = { .retval = true }; + + pkgconf_queue_push(&queue, "does-not-exist"); + TEST_ASSERT_FALSE(pkgconf_queue_apply(client, &queue, apply_cb, -1, &st)); + TEST_ASSERT_EQ(st.calls, 0); + + pkgconf_queue_free(&queue); + pkgconf_client_free(client); +} + +int +main(int argc, char *argv[]) +{ + (void) argc; + const char *basename = pkgconf_path_find_basename(argv[0]); + + setup_fixtures(); + + TEST_RUN(basename, test_queue_validate_success); + TEST_RUN(basename, test_queue_validate_version_satisfied); + TEST_RUN(basename, test_queue_validate_missing_package); + TEST_RUN(basename, test_queue_validate_unsatisfiable_version); + TEST_RUN(basename, test_queue_validate_empty); + TEST_RUN(basename, test_queue_apply_success); + TEST_RUN(basename, test_queue_apply_callback_failure); + TEST_RUN(basename, test_queue_apply_missing_package); + + teardown_fixtures(); + + return EXIT_SUCCESS; +} diff --git a/tests/api/test-version.c b/tests/api/test-version.c new file mode 100644 index 000000000000..71ed2c1de811 --- /dev/null +++ b/tests/api/test-version.c @@ -0,0 +1,133 @@ +/* + * test-version.c + * Tests for the public libpkgconf version comparison API. + * + * SPDX-License-Identifier: pkgconf + * + * Copyright (c) 2026 pkgconf authors (see AUTHORS). + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * This software is provided 'as is' and without any warranty, express or + * implied. In no event shall the authors be liable for any damages arising + * from the use of this software. + */ + +#include "test-api.h" + +static void +cmp_lt(const char *a, const char *b) +{ + TEST_ASSERT_EQ(pkgconf_compare_version(a, b), -1); + TEST_ASSERT_EQ(pkgconf_compare_version(b, a), 1); +} + +static void +cmp_eq(const char *a, const char *b) +{ + TEST_ASSERT_EQ(pkgconf_compare_version(a, b), 0); + TEST_ASSERT_EQ(pkgconf_compare_version(b, a), 0); +} + +static void +test_version_equal(void) +{ + cmp_eq("1.0.0", "1.0.0"); + cmp_eq("", ""); + cmp_eq("abc", "abc"); + cmp_eq("1.0a", "1.0A"); + cmp_eq("RELEASE", "release"); +} + +static void +test_version_null(void) +{ + TEST_ASSERT_EQ(pkgconf_compare_version(NULL, NULL), -1); + cmp_lt(NULL, "1.0"); + cmp_lt(NULL, ""); +} + +static void +test_version_numeric(void) +{ + cmp_lt("1.0.0", "1.0.1"); + cmp_lt("0.9", "1.0"); + cmp_lt("1.9.9", "2.0.0"); + cmp_lt("1.9", "1.10"); + cmp_lt("1.9", "1.100"); +} + +static void +test_version_leading_zeros(void) +{ + cmp_eq("1.0", "1.00"); + cmp_eq("1.7", "1.007"); + cmp_eq("01.02.03", "1.2.3"); + cmp_lt("1.0.1", "1.0.10"); +} + +static void +test_version_component_count(void) +{ + cmp_lt("1.0", "1.0.1"); + cmp_lt("1.0", "1.0.0"); + cmp_lt("1.2.3", "1.2.3.1"); +} + +static void +test_version_separators(void) +{ + cmp_eq("1.2.3", "1-2-3"); + cmp_eq("1.2.3", "1_2_3"); + cmp_eq("1.2.3", "1:2:3"); + cmp_eq("1.0", "1...0"); +} + +static void +test_version_tilde(void) +{ + cmp_lt("1.0~rc1", "1.0"); + cmp_lt("1.0~rc1", "1.0~rc2"); + cmp_lt("1.0~~", "1.0~"); + cmp_lt("1.0~1", "1.0.1"); + cmp_lt("1.0.0~beta", "1.0.0"); +} + +static void +test_version_alpha_numeric(void) +{ + cmp_lt("1.b", "1.5"); + cmp_lt("1.0.alpha", "1.0.beta"); + cmp_lt("1.0alpha", "1.0alphabeta"); + cmp_lt("1.0", "1.0pre"); +} + +static void +test_version_real_world(void) +{ + cmp_lt("2.5.1", "2.9.91"); + cmp_lt("2.9.91", "3.0.0"); + cmp_lt("1.0.0~beta", "1.0.0~rc1"); + cmp_lt("1.0.0~rc1", "1.0.0"); +} + +int +main(int argc, char *argv[]) +{ + (void) argc; + const char *basename = pkgconf_path_find_basename(argv[0]); + + TEST_RUN(basename, test_version_equal); + TEST_RUN(basename, test_version_null); + TEST_RUN(basename, test_version_numeric); + TEST_RUN(basename, test_version_leading_zeros); + TEST_RUN(basename, test_version_component_count); + TEST_RUN(basename, test_version_separators); + TEST_RUN(basename, test_version_tilde); + TEST_RUN(basename, test_version_alpha_numeric); + TEST_RUN(basename, test_version_real_world); + + return EXIT_SUCCESS; +} diff --git a/tests/lib-sbom-files/agent_name.json b/tests/lib-sbom-files/agent_name.json index 4441e714331f..37694702a5bc 100644 --- a/tests/lib-sbom-files/agent_name.json +++ b/tests/lib-sbom-files/agent_name.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", + "name": "Test3 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", @@ -45,6 +51,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/myagent" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -79,6 +88,7 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/myagent", + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", "https://github.com/pkgconf/pkgconf/Relationship/test3/hasDeclaredLicense", "https://github.com/pkgconf/pkgconf/Relationship/test3/hasConcludedLicense", diff --git a/tests/lib-sbom-files/agent_name_space.json b/tests/lib-sbom-files/agent_name_space.json index e29416adba4e..c773ce8ed5f4 100644 --- a/tests/lib-sbom-files/agent_name_space.json +++ b/tests/lib-sbom-files/agent_name_space.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", + "name": "Test3 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", @@ -45,6 +51,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/my_agent" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -79,6 +88,7 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/my_agent", + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", "https://github.com/pkgconf/pkgconf/Relationship/test3/hasDeclaredLicense", "https://github.com/pkgconf/pkgconf/Relationship/test3/hasConcludedLicense", diff --git a/tests/lib-sbom-files/basic-spdx-base-id.json b/tests/lib-sbom-files/basic-spdx-base-id.json index f9c67b9b9cfb..6271c947609f 100644 --- a/tests/lib-sbom-files/basic-spdx-base-id.json +++ b/tests/lib-sbom-files/basic-spdx-base-id.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://distfiles.ariadne.space/pkgconf/Agent/test3_maintainer", + "name": "Test3 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://distfiles.ariadne.space/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", @@ -45,6 +51,9 @@ "originatedBy": [ "https://distfiles.ariadne.space/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://distfiles.ariadne.space/pkgconf/Agent/test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -79,6 +88,7 @@ ], "element": [ "https://distfiles.ariadne.space/pkgconf/Agent/default", + "https://distfiles.ariadne.space/pkgconf/Agent/test3_maintainer", "https://distfiles.ariadne.space/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", "https://distfiles.ariadne.space/pkgconf/Relationship/test3/hasDeclaredLicense", "https://distfiles.ariadne.space/pkgconf/Relationship/test3/hasConcludedLicense", diff --git a/tests/lib-sbom-files/basic-use-uri.json b/tests/lib-sbom-files/basic-use-uri.json index e9913a92a764..338493050545 100644 --- a/tests/lib-sbom-files/basic-use-uri.json +++ b/tests/lib-sbom-files/basic-use-uri.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "github.com:pkgconf:pkgconf:Agent:test3_maintainer", + "name": "Test3 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "github.com:pkgconf:pkgconf:simplelicensing_LicenseExpression:BSD-4-Clause", @@ -45,6 +51,9 @@ "originatedBy": [ "github.com:pkgconf:pkgconf:Agent:default" ], + "suppliedBy": [ + "github.com:pkgconf:pkgconf:Agent:test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -79,6 +88,7 @@ ], "element": [ "github.com:pkgconf:pkgconf:Agent:default", + "github.com:pkgconf:pkgconf:Agent:test3_maintainer", "github.com:pkgconf:pkgconf:simplelicensing_LicenseExpression:BSD-4-Clause", "github.com:pkgconf:pkgconf:Relationship:test3:hasDeclaredLicense", "github.com:pkgconf:pkgconf:Relationship:test3:hasConcludedLicense", diff --git a/tests/lib-sbom-files/basic.json b/tests/lib-sbom-files/basic.json index 3b241ff3442d..b924b0317604 100644 --- a/tests/lib-sbom-files/basic.json +++ b/tests/lib-sbom-files/basic.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", + "name": "Test3 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", @@ -45,6 +51,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -79,6 +88,7 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", "https://github.com/pkgconf/pkgconf/Relationship/test3/hasDeclaredLicense", "https://github.com/pkgconf/pkgconf/Relationship/test3/hasConcludedLicense", diff --git a/tests/lib-sbom-files/bomtool-basic.txt b/tests/lib-sbom-files/bomtool-basic.txt index 9adeec9ae8dc..6c1fa22e8a6c 100644 --- a/tests/lib-sbom-files/bomtool-basic.txt +++ b/tests/lib-sbom-files/bomtool-basic.txt @@ -13,6 +13,7 @@ PackageName: test3@3.0.0 SPDXID: SPDXRef-Package-test3C403.0.0 PackageVersion: 3.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test3 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/ PackageLicenseDeclared: BSD-4-Clause PackageLicenseConcluded: NOASSERTION diff --git a/tests/lib-sbom-files/bomtool-define_variable.txt b/tests/lib-sbom-files/bomtool-define_variable.txt index 95478ffc6431..13fa3a04a042 100644 --- a/tests/lib-sbom-files/bomtool-define_variable.txt +++ b/tests/lib-sbom-files/bomtool-define_variable.txt @@ -13,6 +13,7 @@ PackageName: variable-test1@1.0-123 SPDXID: SPDXRef-Package-variable-test1C401.0-123 PackageVersion: 1.0-123 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Variabletest1 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/releases/ PackageLicenseDeclared: BSD-2-Clause PackageLicenseConcluded: NOASSERTION diff --git a/tests/lib-sbom-files/bomtool-define_variable_with_dependency.txt b/tests/lib-sbom-files/bomtool-define_variable_with_dependency.txt index 571ec7cc58ea..6ced6ec3e758 100644 --- a/tests/lib-sbom-files/bomtool-define_variable_with_dependency.txt +++ b/tests/lib-sbom-files/bomtool-define_variable_with_dependency.txt @@ -13,6 +13,7 @@ PackageName: variable-test2@2.0 SPDXID: SPDXRef-Package-variable-test2C402.0 PackageVersion: 2.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Variabletest2 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/releases/ PackageLicenseDeclared: MIT PackageLicenseConcluded: NOASSERTION @@ -27,6 +28,7 @@ PackageName: variable-test1@1.0-123 SPDXID: SPDXRef-Package-variable-test1C401.0-123 PackageVersion: 1.0-123 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Variabletest1 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/releases/ PackageLicenseDeclared: BSD-2-Clause PackageLicenseConcluded: NOASSERTION diff --git a/tests/lib-sbom-files/bomtool-meta_package.txt b/tests/lib-sbom-files/bomtool-meta_package.txt index 6aa089dc5a48..0a24d37c0695 100644 --- a/tests/lib-sbom-files/bomtool-meta_package.txt +++ b/tests/lib-sbom-files/bomtool-meta_package.txt @@ -13,6 +13,7 @@ PackageName: meta_package@1.0.0 SPDXID: SPDXRef-Package-metaC5fpackageC401.0.0 PackageVersion: 1.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Meta Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf PackageLicenseDeclared: BSD-2-Clause PackageLicenseConcluded: NOASSERTION @@ -27,6 +28,7 @@ PackageName: test1@1.0.0 SPDXID: SPDXRef-Package-test1C401.0.0 PackageVersion: 1.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test1 Maintainer PackageLicenseDeclared: BSD-1-Clause PackageLicenseConcluded: NOASSERTION PackageCopyrightText: <text>Test1 copyright text</text> @@ -40,6 +42,7 @@ PackageName: test2@2.0.0 SPDXID: SPDXRef-Package-test2C402.0.0 PackageVersion: 2.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test2 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/ PackageLicenseDeclared: BSD-2-Clause PackageLicenseConcluded: NOASSERTION @@ -54,6 +57,7 @@ PackageName: test3@3.0.0 SPDXID: SPDXRef-Package-test3C403.0.0 PackageVersion: 3.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test3 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/ PackageLicenseDeclared: BSD-4-Clause PackageLicenseConcluded: NOASSERTION @@ -68,6 +72,7 @@ PackageName: test4@4.0.0 SPDXID: SPDXRef-Package-test4C404.0.0 PackageVersion: 4.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test4 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/ PackageLicenseDeclared: MIT PackageLicenseConcluded: NOASSERTION @@ -82,6 +87,7 @@ PackageName: test5@5.0.0 SPDXID: SPDXRef-Package-test5C405.0.0 PackageVersion: 5.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test5 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/ PackageLicenseDeclared: MIT PackageLicenseConcluded: NOASSERTION @@ -96,6 +102,7 @@ PackageName: test6@6.0.0 SPDXID: SPDXRef-Package-test6C406.0.0 PackageVersion: 6.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test6 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/releases/ PackageLicenseDeclared: Apache-2.0 PackageLicenseConcluded: NOASSERTION diff --git a/tests/lib-sbom-files/bomtool-multiple_packages.txt b/tests/lib-sbom-files/bomtool-multiple_packages.txt index 58c1e2dc827d..2637e3ee3076 100644 --- a/tests/lib-sbom-files/bomtool-multiple_packages.txt +++ b/tests/lib-sbom-files/bomtool-multiple_packages.txt @@ -13,6 +13,7 @@ PackageName: test5@5.0.0 SPDXID: SPDXRef-Package-test5C405.0.0 PackageVersion: 5.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test5 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/ PackageLicenseDeclared: MIT PackageLicenseConcluded: NOASSERTION @@ -27,6 +28,7 @@ PackageName: test6@6.0.0 SPDXID: SPDXRef-Package-test6C406.0.0 PackageVersion: 6.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test6 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/releases/ PackageLicenseDeclared: Apache-2.0 PackageLicenseConcluded: NOASSERTION diff --git a/tests/lib-sbom-files/bomtool-nolicense.txt b/tests/lib-sbom-files/bomtool-nolicense.txt index 3fdca7694ef7..d79fa8c4345c 100644 --- a/tests/lib-sbom-files/bomtool-nolicense.txt +++ b/tests/lib-sbom-files/bomtool-nolicense.txt @@ -13,6 +13,7 @@ PackageName: nolicense@1.0.0 SPDXID: SPDXRef-Package-nolicenseC401.0.0 PackageVersion: 1.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Nolicense Maintainer PackageHomePage: https://example.com/nolicense PackageLicenseDeclared: NOASSERTION PackageLicenseConcluded: NOASSERTION diff --git a/tests/lib-sbom-files/bomtool-private_dependency.txt b/tests/lib-sbom-files/bomtool-private_dependency.txt new file mode 100644 index 000000000000..a9657ee553f9 --- /dev/null +++ b/tests/lib-sbom-files/bomtool-private_dependency.txt @@ -0,0 +1,45 @@ +SPDXVersion: SPDX-2.2 +DataLicense: CC0-1.0 +SPDXID: SPDXRef-DOCUMENT +DocumentName: SBOM-SPDX-priv-parentC401.0.0 +DocumentNamespace: https://spdx.org/spdxdocs/bomtool +Creator: Tool: bomtool +Created: test + + +##### Package: priv-parent@1.0.0 + +PackageName: priv-parent@1.0.0 +SPDXID: SPDXRef-Package-priv-parentC401.0.0 +PackageVersion: 1.0.0 +PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Privparent Maintainer +PackageHomePage: https://example.com/priv-parent +PackageLicenseDeclared: MIT +PackageLicenseConcluded: NOASSERTION +PackageCopyrightText: NOASSERTION +PackageSummary: <text>Package with a private dependency</text> +PackageDownloadLocation: NOASSERTION + + +##### Package: priv-child@1.0.0 + +PackageName: priv-child@1.0.0 +SPDXID: SPDXRef-Package-priv-childC401.0.0 +PackageVersion: 1.0.0 +PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Privchild Maintainer +PackageHomePage: https://example.com/priv-child +PackageLicenseDeclared: MIT +PackageLicenseConcluded: NOASSERTION +PackageCopyrightText: NOASSERTION +PackageSummary: <text>Private dependency child</text> +PackageDownloadLocation: NOASSERTION + + +Relationship: SPDXRef-Package-priv-parentC401.0.0 DEPENDS_ON SPDXRef-Package-priv-childC401.0.0 +Relationship: SPDXRef-Package-priv-childC401.0.0 DEV_DEPENDENCY_OF SPDXRef-Package-priv-parentC401.0.0 + + +Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-Package-priv-parentC401.0.0 +Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-Package-priv-childC401.0.0 diff --git a/tests/lib-sbom-files/bomtool-special.txt b/tests/lib-sbom-files/bomtool-special.txt index 415d0f448c25..3cabf2da4fe4 100644 --- a/tests/lib-sbom-files/bomtool-special.txt +++ b/tests/lib-sbom-files/bomtool-special.txt @@ -13,6 +13,7 @@ PackageName: special@1.0.0 SPDXID: SPDXRef-Package-specialC401.0.0 PackageVersion: 1.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Special Maintainer PackageHomePage: https://example.com/special PackageLicenseDeclared: MIT PackageLicenseConcluded: NOASSERTION diff --git a/tests/lib-sbom-files/bomtool-with_dependency.txt b/tests/lib-sbom-files/bomtool-with_dependency.txt index 6e40e06a683b..e74f6c398104 100644 --- a/tests/lib-sbom-files/bomtool-with_dependency.txt +++ b/tests/lib-sbom-files/bomtool-with_dependency.txt @@ -13,6 +13,7 @@ PackageName: test2@2.0.0 SPDXID: SPDXRef-Package-test2C402.0.0 PackageVersion: 2.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test2 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/ PackageLicenseDeclared: BSD-2-Clause PackageLicenseConcluded: NOASSERTION @@ -27,6 +28,7 @@ PackageName: test3@3.0.0 SPDXID: SPDXRef-Package-test3C403.0.0 PackageVersion: 3.0.0 PackageDownloadLocation: NOASSERTION +PackageSupplier: Person: Test3 Maintainer PackageHomePage: https://github.com/pkgconf/pkgconf/ PackageLicenseDeclared: BSD-4-Clause PackageLicenseConcluded: NOASSERTION diff --git a/tests/lib-sbom-files/creation_id.json b/tests/lib-sbom-files/creation_id.json index 529d5b8ec296..ef09de67cba9 100644 --- a/tests/lib-sbom-files/creation_id.json +++ b/tests/lib-sbom-files/creation_id.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:custom_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", + "name": "Test3 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:custom_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", @@ -45,6 +51,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -79,6 +88,7 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", "https://github.com/pkgconf/pkgconf/Relationship/test3/hasDeclaredLicense", "https://github.com/pkgconf/pkgconf/Relationship/test3/hasConcludedLicense", diff --git a/tests/lib-sbom-files/define_variable.json b/tests/lib-sbom-files/define_variable.json index bef19f2f3de1..d97d0080fed4 100644 --- a/tests/lib-sbom-files/define_variable.json +++ b/tests/lib-sbom-files/define_variable.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/variabletest1_maintainer", + "name": "Variabletest1 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-2-Clause", @@ -45,6 +51,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/variabletest1_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/releases/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -79,6 +88,7 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/variabletest1_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-2-Clause", "https://github.com/pkgconf/pkgconf/Relationship/variable-test1/hasDeclaredLicense", "https://github.com/pkgconf/pkgconf/Relationship/variable-test1/hasConcludedLicense", diff --git a/tests/lib-sbom-files/define_variable_with_dependency.json b/tests/lib-sbom-files/define_variable_with_dependency.json index cad5b0b269b3..1aa4d8495c41 100644 --- a/tests/lib-sbom-files/define_variable_with_dependency.json +++ b/tests/lib-sbom-files/define_variable_with_dependency.json @@ -17,6 +17,18 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/variabletest2_maintainer", + "name": "Variabletest2 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/variabletest1_maintainer", + "name": "Variabletest1 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", @@ -67,6 +79,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/variabletest2_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/releases/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -80,6 +95,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/variabletest1_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/releases/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -145,7 +163,9 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/variabletest2_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", + "https://github.com/pkgconf/pkgconf/Agent/variabletest1_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-2-Clause", "https://github.com/pkgconf/pkgconf/Relationship/variable-test2/dependsOn/variable-test1", "https://github.com/pkgconf/pkgconf/Relationship/variable-test2/hasDeclaredLicense", diff --git a/tests/lib-sbom-files/meta_package-use-uri-spdx-base-id.json b/tests/lib-sbom-files/meta_package-use-uri-spdx-base-id.json index ad18ded896c3..b21e316c6a14 100644 --- a/tests/lib-sbom-files/meta_package-use-uri-spdx-base-id.json +++ b/tests/lib-sbom-files/meta_package-use-uri-spdx-base-id.json @@ -17,6 +17,48 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "distfiles.ariadne.space:pkgconf:Agent:meta_maintainer", + "name": "Meta Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "distfiles.ariadne.space:pkgconf:Agent:test1_maintainer", + "name": "Test1 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "distfiles.ariadne.space:pkgconf:Agent:test2_maintainer", + "name": "Test2 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "distfiles.ariadne.space:pkgconf:Agent:test3_maintainer", + "name": "Test3 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "distfiles.ariadne.space:pkgconf:Agent:test4_maintainer", + "name": "Test4 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "distfiles.ariadne.space:pkgconf:Agent:test5_maintainer", + "name": "Test5 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "distfiles.ariadne.space:pkgconf:Agent:test6_maintainer", + "name": "Test6 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "distfiles.ariadne.space:pkgconf:simplelicensing_LicenseExpression:BSD-2-Clause", @@ -168,6 +210,9 @@ "originatedBy": [ "distfiles.ariadne.space:pkgconf:Agent:default" ], + "suppliedBy": [ + "distfiles.ariadne.space:pkgconf:Agent:meta_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -181,6 +226,9 @@ "originatedBy": [ "distfiles.ariadne.space:pkgconf:Agent:default" ], + "suppliedBy": [ + "distfiles.ariadne.space:pkgconf:Agent:test1_maintainer" + ], "software_copyrightText": "Test1 copyright text", "software_homePage": "", "software_downloadLocation": "", @@ -194,6 +242,9 @@ "originatedBy": [ "distfiles.ariadne.space:pkgconf:Agent:default" ], + "suppliedBy": [ + "distfiles.ariadne.space:pkgconf:Agent:test2_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -207,6 +258,9 @@ "originatedBy": [ "distfiles.ariadne.space:pkgconf:Agent:default" ], + "suppliedBy": [ + "distfiles.ariadne.space:pkgconf:Agent:test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -220,6 +274,9 @@ "originatedBy": [ "distfiles.ariadne.space:pkgconf:Agent:default" ], + "suppliedBy": [ + "distfiles.ariadne.space:pkgconf:Agent:test4_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -233,6 +290,9 @@ "originatedBy": [ "distfiles.ariadne.space:pkgconf:Agent:default" ], + "suppliedBy": [ + "distfiles.ariadne.space:pkgconf:Agent:test5_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -246,6 +306,9 @@ "originatedBy": [ "distfiles.ariadne.space:pkgconf:Agent:default" ], + "suppliedBy": [ + "distfiles.ariadne.space:pkgconf:Agent:test6_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/releases/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -496,10 +559,17 @@ ], "element": [ "distfiles.ariadne.space:pkgconf:Agent:default", + "distfiles.ariadne.space:pkgconf:Agent:meta_maintainer", "distfiles.ariadne.space:pkgconf:simplelicensing_LicenseExpression:BSD-2-Clause", + "distfiles.ariadne.space:pkgconf:Agent:test1_maintainer", "distfiles.ariadne.space:pkgconf:simplelicensing_LicenseExpression:BSD-1-Clause", + "distfiles.ariadne.space:pkgconf:Agent:test2_maintainer", + "distfiles.ariadne.space:pkgconf:Agent:test3_maintainer", "distfiles.ariadne.space:pkgconf:simplelicensing_LicenseExpression:BSD-4-Clause", + "distfiles.ariadne.space:pkgconf:Agent:test4_maintainer", "distfiles.ariadne.space:pkgconf:simplelicensing_LicenseExpression:MIT", + "distfiles.ariadne.space:pkgconf:Agent:test5_maintainer", + "distfiles.ariadne.space:pkgconf:Agent:test6_maintainer", "distfiles.ariadne.space:pkgconf:simplelicensing_LicenseExpression:Apache-2.0", "distfiles.ariadne.space:pkgconf:Relationship:meta_package:dependsOn:test1", "distfiles.ariadne.space:pkgconf:Relationship:meta_package:dependsOn:test2", diff --git a/tests/lib-sbom-files/meta_package.json b/tests/lib-sbom-files/meta_package.json index 248d663a6a1e..d033211f40cb 100644 --- a/tests/lib-sbom-files/meta_package.json +++ b/tests/lib-sbom-files/meta_package.json @@ -17,6 +17,48 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/meta_maintainer", + "name": "Meta Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test1_maintainer", + "name": "Test1 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test2_maintainer", + "name": "Test2 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", + "name": "Test3 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test4_maintainer", + "name": "Test4 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test5_maintainer", + "name": "Test5 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test6_maintainer", + "name": "Test6 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-2-Clause", @@ -168,6 +210,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/meta_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -181,6 +226,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test1_maintainer" + ], "software_copyrightText": "Test1 copyright text", "software_homePage": "", "software_downloadLocation": "", @@ -194,6 +242,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test2_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -207,6 +258,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -220,6 +274,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test4_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -233,6 +290,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test5_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -246,6 +306,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test6_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/releases/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -496,10 +559,17 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/meta_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-2-Clause", + "https://github.com/pkgconf/pkgconf/Agent/test1_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-1-Clause", + "https://github.com/pkgconf/pkgconf/Agent/test2_maintainer", + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", + "https://github.com/pkgconf/pkgconf/Agent/test4_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", + "https://github.com/pkgconf/pkgconf/Agent/test5_maintainer", + "https://github.com/pkgconf/pkgconf/Agent/test6_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/Apache-2.0", "https://github.com/pkgconf/pkgconf/Relationship/meta_package/dependsOn/test1", "https://github.com/pkgconf/pkgconf/Relationship/meta_package/dependsOn/test2", diff --git a/tests/lib-sbom-files/multi_copyright.json b/tests/lib-sbom-files/multi_copyright.json index cf32487cfe19..651ca80deb3d 100644 --- a/tests/lib-sbom-files/multi_copyright.json +++ b/tests/lib-sbom-files/multi_copyright.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/mc_maintainer", + "name": "MC Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", @@ -45,6 +51,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/mc_maintainer" + ], "software_copyrightText": "First copyright holder\nSecond copyright holder", "software_homePage": "https://example.com/mc", "software_downloadLocation": "", @@ -79,6 +88,7 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/mc_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", "https://github.com/pkgconf/pkgconf/Relationship/multi-copyright/hasDeclaredLicense", "https://github.com/pkgconf/pkgconf/Relationship/multi-copyright/hasConcludedLicense", diff --git a/tests/lib-sbom-files/multiple_packages.json b/tests/lib-sbom-files/multiple_packages.json index 3e9303c478b7..62cb4d4f68a5 100644 --- a/tests/lib-sbom-files/multiple_packages.json +++ b/tests/lib-sbom-files/multiple_packages.json @@ -17,6 +17,18 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test5_maintainer", + "name": "Test5 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test6_maintainer", + "name": "Test6 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", @@ -66,6 +78,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test5_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -79,6 +94,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test6_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/releases/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -134,7 +152,9 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/test5_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", + "https://github.com/pkgconf/pkgconf/Agent/test6_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/Apache-2.0", "https://github.com/pkgconf/pkgconf/Relationship/test5/hasDeclaredLicense", "https://github.com/pkgconf/pkgconf/Relationship/test5/hasConcludedLicense", diff --git a/tests/lib-sbom-files/nolicense.json b/tests/lib-sbom-files/nolicense.json index d5d8ac639979..e45dd5c2299f 100644 --- a/tests/lib-sbom-files/nolicense.json +++ b/tests/lib-sbom-files/nolicense.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/nolicense_maintainer", + "name": "Nolicense Maintainer" + }, + { "type": "software_Sbom", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/software_Sbom/nolicense", @@ -37,6 +43,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/nolicense_maintainer" + ], "software_copyrightText": "Nolicense copyright text", "software_homePage": "https://example.com/nolicense", "software_downloadLocation": "https://example.com/nolicense/nolicense-1.0.0.tar.gz", @@ -51,6 +60,7 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/nolicense_maintainer", "https://github.com/pkgconf/pkgconf/software_Sbom/nolicense", "https://github.com/pkgconf/pkgconf/Package/nolicense" ] diff --git a/tests/lib-sbom-files/private_dependency.json b/tests/lib-sbom-files/private_dependency.json new file mode 100644 index 000000000000..c824794183f7 --- /dev/null +++ b/tests/lib-sbom-files/private_dependency.json @@ -0,0 +1,176 @@ +{ + "@context": "https://spdx.org/rdf/3.0.1/spdx-context.jsonld", + "@graph": [ + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/default", + "name": "Default" + }, + { + "type": "CreationInfo", + "@id": "_:creationinfo_1", + "created": "test", + "createdBy": [ + "https://github.com/pkgconf/pkgconf/Agent/default" + ], + "specVersion": "3.0.1" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/privparent_maintainer", + "name": "Privparent Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/privchild_maintainer", + "name": "Privchild Maintainer" + }, + { + "type": "simplelicensing_LicenseExpression", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", + "simplelicensing_licenseExpression": "MIT" + }, + { + "type": "software_Sbom", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/software_Sbom/priv-parent", + "software_sbomType": [ + "build" + ], + "rootElement": [ + "https://github.com/pkgconf/pkgconf/Package/priv-parent" + ], + "element": [ + "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/dependsOn/priv-child", + "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/hasDeclaredLicense", + "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/hasConcludedLicense" + ] + }, + { + "type": "software_Sbom", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/software_Sbom/priv-child", + "software_sbomType": [ + "build" + ], + "rootElement": [ + "https://github.com/pkgconf/pkgconf/Package/priv-child" + ], + "element": [ + "https://github.com/pkgconf/pkgconf/Relationship/priv-child/hasDeclaredLicense", + "https://github.com/pkgconf/pkgconf/Relationship/priv-child/hasConcludedLicense" + ] + }, + { + "type": "software_Package", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Package/priv-parent", + "name": "priv-parent", + "originatedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/default" + ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/privparent_maintainer" + ], + "software_copyrightText": "NOASSERTION", + "software_homePage": "https://example.com/priv-parent", + "software_downloadLocation": "", + "software_packageVersion": "1.0.0" + }, + { + "type": "software_Package", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Package/priv-child", + "name": "priv-child", + "originatedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/default" + ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/privchild_maintainer" + ], + "software_copyrightText": "NOASSERTION", + "software_homePage": "https://example.com/priv-child", + "software_downloadLocation": "", + "software_packageVersion": "1.0.0" + }, + { + "type": "Relationship", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/hasDeclaredLicense", + "from": "https://github.com/pkgconf/pkgconf/Package/priv-parent", + "to": [ + "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT" + ], + "relationshipType": "hasDeclaredLicense" + }, + { + "type": "Relationship", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/hasConcludedLicense", + "from": "https://github.com/pkgconf/pkgconf/Package/priv-parent", + "to": [ + "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT" + ], + "relationshipType": "hasConcludedLicense" + }, + { + "type": "LifecycleScopedRelationship", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/dependsOn/priv-child", + "from": "https://github.com/pkgconf/pkgconf/Package/priv-parent", + "to": [ + "https://github.com/pkgconf/pkgconf/Package/priv-child" + ], + "relationshipType": "dependsOn", + "scope": "development" + }, + { + "type": "Relationship", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Relationship/priv-child/hasDeclaredLicense", + "from": "https://github.com/pkgconf/pkgconf/Package/priv-child", + "to": [ + "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT" + ], + "relationshipType": "hasDeclaredLicense" + }, + { + "type": "Relationship", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Relationship/priv-child/hasConcludedLicense", + "from": "https://github.com/pkgconf/pkgconf/Package/priv-child", + "to": [ + "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT" + ], + "relationshipType": "hasConcludedLicense" + }, + { + "type": "SpdxDocument", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/spdxDocument/1", + "rootElement": [ + "https://github.com/pkgconf/pkgconf/software_Sbom/priv-parent", + "https://github.com/pkgconf/pkgconf/software_Sbom/priv-child" + ], + "element": [ + "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/privparent_maintainer", + "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", + "https://github.com/pkgconf/pkgconf/Agent/privchild_maintainer", + "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/dependsOn/priv-child", + "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/hasDeclaredLicense", + "https://github.com/pkgconf/pkgconf/Relationship/priv-parent/hasConcludedLicense", + "https://github.com/pkgconf/pkgconf/Relationship/priv-child/hasDeclaredLicense", + "https://github.com/pkgconf/pkgconf/Relationship/priv-child/hasConcludedLicense", + "https://github.com/pkgconf/pkgconf/software_Sbom/priv-parent", + "https://github.com/pkgconf/pkgconf/Package/priv-parent", + "https://github.com/pkgconf/pkgconf/software_Sbom/priv-child", + "https://github.com/pkgconf/pkgconf/Package/priv-child" + ] + } + ] +} diff --git a/tests/lib-sbom-files/special.json b/tests/lib-sbom-files/special.json index 34d55df409ee..3d4fa7abae69 100644 --- a/tests/lib-sbom-files/special.json +++ b/tests/lib-sbom-files/special.json @@ -17,6 +17,12 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/special_maintainer", + "name": "Special Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", @@ -45,6 +51,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/special_maintainer" + ], "software_copyrightText": "Quote \" backslash \\ and\ttab", "software_homePage": "https://example.com/special", "software_downloadLocation": "", @@ -79,6 +88,7 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/special_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/MIT", "https://github.com/pkgconf/pkgconf/Relationship/special/hasDeclaredLicense", "https://github.com/pkgconf/pkgconf/Relationship/special/hasConcludedLicense", diff --git a/tests/lib-sbom-files/with_dependency.json b/tests/lib-sbom-files/with_dependency.json index d2036259550c..583fd5a6d81b 100644 --- a/tests/lib-sbom-files/with_dependency.json +++ b/tests/lib-sbom-files/with_dependency.json @@ -17,6 +17,18 @@ "specVersion": "3.0.1" }, { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test2_maintainer", + "name": "Test2 Maintainer" + }, + { + "type": "Agent", + "creationInfo": "_:creationinfo_1", + "spdxId": "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", + "name": "Test3 Maintainer" + }, + { "type": "simplelicensing_LicenseExpression", "creationInfo": "_:creationinfo_1", "spdxId": "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-2-Clause", @@ -67,6 +79,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test2_maintainer" + ], "software_copyrightText": "NOASSERTION", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -80,6 +95,9 @@ "originatedBy": [ "https://github.com/pkgconf/pkgconf/Agent/default" ], + "suppliedBy": [ + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer" + ], "software_copyrightText": "Test3 copyright text", "software_homePage": "https://github.com/pkgconf/pkgconf/", "software_downloadLocation": "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz", @@ -145,7 +163,9 @@ ], "element": [ "https://github.com/pkgconf/pkgconf/Agent/default", + "https://github.com/pkgconf/pkgconf/Agent/test2_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-2-Clause", + "https://github.com/pkgconf/pkgconf/Agent/test3_maintainer", "https://github.com/pkgconf/pkgconf/simplelicensing_LicenseExpression/BSD-4-Clause", "https://github.com/pkgconf/pkgconf/Relationship/test2/dependsOn/test3", "https://github.com/pkgconf/pkgconf/Relationship/test2/hasDeclaredLicense", diff --git a/tests/lib-sbom/meta_package.pc b/tests/lib-sbom/meta_package.pc index f3dd872ad2d5..37ec64c2d350 100644 --- a/tests/lib-sbom/meta_package.pc +++ b/tests/lib-sbom/meta_package.pc @@ -10,3 +10,4 @@ Requires: test1 \ test6 Source: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz License: BSD-2-Clause +Maintainer: Meta Maintainer diff --git a/tests/lib-sbom/multi-copyright.pc b/tests/lib-sbom/multi-copyright.pc index 464a641d47db..3a9c443c6617 100644 --- a/tests/lib-sbom/multi-copyright.pc +++ b/tests/lib-sbom/multi-copyright.pc @@ -5,3 +5,4 @@ Version: 1.0.0 License: MIT Copyright: First copyright holder Copyright: Second copyright holder +Maintainer: MC Maintainer diff --git a/tests/lib-sbom/nolicense.pc b/tests/lib-sbom/nolicense.pc index 0793297f637b..ca992a39b736 100644 --- a/tests/lib-sbom/nolicense.pc +++ b/tests/lib-sbom/nolicense.pc @@ -4,3 +4,4 @@ URL: https://example.com/nolicense Version: 1.0.0 Copyright: Nolicense copyright text Source: https://example.com/nolicense/nolicense-1.0.0.tar.gz +Maintainer: Nolicense Maintainer diff --git a/tests/lib-sbom/priv-child.pc b/tests/lib-sbom/priv-child.pc new file mode 100644 index 000000000000..ce9f8f8eb2b0 --- /dev/null +++ b/tests/lib-sbom/priv-child.pc @@ -0,0 +1,6 @@ +Name: priv-child +Description: Private dependency child +URL: https://example.com/priv-child +Version: 1.0.0 +License: MIT +Maintainer: Privchild Maintainer diff --git a/tests/lib-sbom/priv-parent.pc b/tests/lib-sbom/priv-parent.pc new file mode 100644 index 000000000000..400cfb2b1bf2 --- /dev/null +++ b/tests/lib-sbom/priv-parent.pc @@ -0,0 +1,7 @@ +Name: priv-parent +Description: Package with a private dependency +URL: https://example.com/priv-parent +Version: 1.0.0 +License: MIT +Requires.private: priv-child +Maintainer: Privparent Maintainer diff --git a/tests/lib-sbom/special.pc b/tests/lib-sbom/special.pc index 7d95d54584fa..80edc08d834a 100644 --- a/tests/lib-sbom/special.pc +++ b/tests/lib-sbom/special.pc @@ -4,3 +4,4 @@ URL: https://example.com/special Version: 1.0.0 License: MIT Copyright: Quote " backslash \ and tab +Maintainer: Special Maintainer diff --git a/tests/lib-sbom/test1.pc b/tests/lib-sbom/test1.pc index 2cde40250c3f..f7446cac23a6 100644 --- a/tests/lib-sbom/test1.pc +++ b/tests/lib-sbom/test1.pc @@ -4,3 +4,4 @@ Version: 1.0.0 License: BSD-1-Clause Copyright: Test1 copyright text Requires: test1 +Maintainer: Test1 Maintainer diff --git a/tests/lib-sbom/test2.pc b/tests/lib-sbom/test2.pc index d8c6f5dc9537..87240758b1dc 100644 --- a/tests/lib-sbom/test2.pc +++ b/tests/lib-sbom/test2.pc @@ -5,3 +5,4 @@ Version: 2.0.0 Requires: test3 License: BSD-2-Clause Source: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz +Maintainer: Test2 Maintainer diff --git a/tests/lib-sbom/test3.pc b/tests/lib-sbom/test3.pc index af65789843c1..d589d7eb9611 100644 --- a/tests/lib-sbom/test3.pc +++ b/tests/lib-sbom/test3.pc @@ -6,3 +6,4 @@ License: BSD-4-Clause Copyright: Test3 copyright text Source: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz +Maintainer: Test3 Maintainer diff --git a/tests/lib-sbom/test4.pc b/tests/lib-sbom/test4.pc index 502a5fec8445..ce57ce8c8fa9 100644 --- a/tests/lib-sbom/test4.pc +++ b/tests/lib-sbom/test4.pc @@ -6,3 +6,4 @@ License: MIT Source: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz Requires: test5 \ test6 +Maintainer: Test4 Maintainer diff --git a/tests/lib-sbom/test5.pc b/tests/lib-sbom/test5.pc index 62e77cc3e05a..257c86045016 100644 --- a/tests/lib-sbom/test5.pc +++ b/tests/lib-sbom/test5.pc @@ -5,3 +5,4 @@ Version: 5.0.0 License: MIT Source: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz +Maintainer: Test5 Maintainer diff --git a/tests/lib-sbom/test6.pc b/tests/lib-sbom/test6.pc index b87c3805ed25..07eadd15d65f 100644 --- a/tests/lib-sbom/test6.pc +++ b/tests/lib-sbom/test6.pc @@ -5,3 +5,4 @@ Version: 6.0.0 License: Apache-2.0 Source: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz +Maintainer: Test6 Maintainer diff --git a/tests/lib-sbom/variable-test1.pc b/tests/lib-sbom/variable-test1.pc index 51a1a710dc5a..172bebb46c74 100644 --- a/tests/lib-sbom/variable-test1.pc +++ b/tests/lib-sbom/variable-test1.pc @@ -5,3 +5,4 @@ Version: ${VERSION_VARIABLE_TEST} License: BSD-2-Clause Source: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz +Maintainer: Variabletest1 Maintainer diff --git a/tests/lib-sbom/variable-test2.pc b/tests/lib-sbom/variable-test2.pc index 52033aba61b9..14450f88c0f0 100644 --- a/tests/lib-sbom/variable-test2.pc +++ b/tests/lib-sbom/variable-test2.pc @@ -5,3 +5,4 @@ Version: 2.0 License: ${license_variable_test} Source: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.5.1.tar.gz Requires: variable-test1 +Maintainer: Variabletest2 Maintainer diff --git a/tests/lib1/top-builddir.pc b/tests/lib1/top-builddir.pc new file mode 100644 index 000000000000..c60e499825ba --- /dev/null +++ b/tests/lib1/top-builddir.pc @@ -0,0 +1,4 @@ +Name: top-builddir +Description: exercises pc_top_builddir / PKG_CONFIG_TOP_BUILD_DIR +Version: 1.0 +Cflags: -I${pc_top_builddir}/include diff --git a/tests/personality-data/sysrooted.personality b/tests/personality-data/sysrooted.personality new file mode 100644 index 000000000000..9b25e7ee5b02 --- /dev/null +++ b/tests/personality-data/sysrooted.personality @@ -0,0 +1,7 @@ +Triplet: i386-linux-gnu +SysrootDir: /custom/sysroot +DefaultSearchPaths: /usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig +SystemIncludePaths: /usr/lib/i386-linux-gnu/include +SystemLibraryPaths: /usr/lib/i386-linux-gnu/lib +WantDefaultPure: true +WantDefaultStatic: true diff --git a/tests/win-shim.h b/tests/win-shim.h index a58c83d794cc..d870d96fc284 100644 --- a/tests/win-shim.h +++ b/tests/win-shim.h @@ -22,6 +22,8 @@ #include <direct.h> #include <io.h> +#include <fcntl.h> +#include <sys/stat.h> // Shims shared by both MSVC and MSYS2 #define mkdir(p, m) _mkdir(p) @@ -51,6 +53,14 @@ mkdtemp(char *tmpl) return NULL; return tmpl; } + +static inline int +mkstemp(char *tmpl) +{ + if (_mktemp_s(tmpl, strlen(tmpl) + 1) != 0) + return -1; + return _open(tmpl, _O_CREAT | _O_EXCL | _O_RDWR | _O_BINARY, _S_IREAD | _S_IWRITE); +} #endif // _MSC_VER #endif // _WIN32 |
