diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-12 17:20:15 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-12 17:20:15 +0300 |
| commit | 1770b12d5d95476310c27ccf39a91b5ba4a3f119 (patch) | |
| tree | c81bf1d97b5f71140acc73e970abf406f9f64fe7 /tests | |
| parent | f2b8ed6d2ea0744cfd1a36a6fbd1763926b873bb (diff) | |
bootstrap: meson build, test harness, CI, conventions, README/AGENTS (et0)
Phase 0 (task et0): lays the build/test/CI/convention groundwork before any
feature code.
- meson.build: project ggaze C11 -Wall -Wextra; deps gtk4/glib/gio/libadwaita;
feature options gegl/jxl/avif/heif (auto); generated ggaze-config.h with
app id, version, GGAZE_HAVE_* feature flags.
- tests: GLib g_test harness with separate unit/integration suites
(--suite unit / --suite integration); test_bootstrap sanity test proves
the harness compiles and the config header is reachable; -Db_coverage=true
coverage target wired.
- CI: .woodpecker/ci.yml three lanes (minimal, gegl, asan) with xvfb for the
integration track and a coverage lane that warns until M10.
- conventions: .clang-format (3-space, 80-col, K&R, *-on-var, return type on
its own line) + .editorconfig matching docs/coding-conventions.md; CI
clang-format --dry-run -Werror gate.
- top-level README.md (humans) and AGENTS.md (agents) pointing into docs/.
- LICENSE (GPL-3.0-or-later), .gitignore, dir placeholders.
Acceptance: meson setup build && ninja -C build && meson test -C build green;
clang-format --dry-run --Werror clean.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/fixtures/.gitkeep | 0 | ||||
| -rw-r--r-- | tests/helpers/.gitkeep | 0 | ||||
| -rw-r--r-- | tests/integration/meson.build | 3 | ||||
| -rw-r--r-- | tests/meson.build | 22 | ||||
| -rw-r--r-- | tests/test_bootstrap.c | 49 |
5 files changed, 74 insertions, 0 deletions
diff --git a/tests/fixtures/.gitkeep b/tests/fixtures/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/fixtures/.gitkeep diff --git a/tests/helpers/.gitkeep b/tests/helpers/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/helpers/.gitkeep diff --git a/tests/integration/meson.build b/tests/integration/meson.build new file mode 100644 index 0000000..5d540a0 --- /dev/null +++ b/tests/integration/meson.build @@ -0,0 +1,3 @@ +# Integration tests (cross-module flows, real temp dirs, offscreen GTK). +# Empty in Phase 0 — suites land with the milestones that first make each +# flow possible; see docs/IMPLEMENTATION.md "Planned integration suites".
\ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..c0ec9fb --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,22 @@ +# ggaze tests — two tracks (see docs/IMPLEMENTATION.md "Two test tracks"). +# +# unit plain-C module tests, no display needed (>=80% coverage gate, +# warn until M10 then fail). +# integration cross-module flows with real temp dirs + offscreen GTK. +# +# Run one track: meson test -C build --suite unit +# meson test -C build --suite integration +# Coverage: meson setup -Db_coverage=true build +# meson test -C build +# ninja -C build coverage (needs lcov + genhtml) + +test_bootstrap = executable( + 'test_bootstrap', + ['test_bootstrap.c', ggaze_conf_h], + include_directories : inc, + dependencies : [glib_dep], + install : false, +) +test('bootstrap', test_bootstrap, suite : 'unit') + +subdir('integration')
\ No newline at end of file diff --git a/tests/test_bootstrap.c b/tests/test_bootstrap.c new file mode 100644 index 0000000..fea0443 --- /dev/null +++ b/tests/test_bootstrap.c @@ -0,0 +1,49 @@ +/*:* + * ggaze — bootstrap sanity test + * + * Confirms the build/test harness is wired: g_test_init runs, and the + * generated ggaze-config.h exposes the app id and version. No display, + * no GTK — this is the smallest proof that the unit-test track compiles + * and executes under `meson test --suite unit`. + * + * Copyright (c) 2026 ggaze contributors + * SPDX-License-Identifier: GPL-3.0-or-later + *:*/ + +#include "ggaze-config.h" + +#include <glib.h> +#include <string.h> + +static void +test_app_id(void) { + g_assert_cmpstr(GGAZE_APP_ID, ==, "org.buetow.ggaze"); +} + +static void +test_version(void) { + g_assert_cmpstr(GGAZE_VERSION, !=, NULL); + g_assert_cmpint((int)strlen(GGAZE_VERSION), >, 0); +} + +static void +test_feature_flags_are_binary(void) { + /* Feature flags must be 0 or 1, never undefined (compile-time guard). */ + g_assert_cmpint(GGAZE_HAVE_GEGL, >=, 0); + g_assert_cmpint(GGAZE_HAVE_GEGL, <=, 1); + g_assert_cmpint(GGAZE_HAVE_JXL, >=, 0); + g_assert_cmpint(GGAZE_HAVE_JXL, <=, 1); + g_assert_cmpint(GGAZE_HAVE_AVIF, >=, 0); + g_assert_cmpint(GGAZE_HAVE_AVIF, <=, 1); + g_assert_cmpint(GGAZE_HAVE_HEIF, >=, 0); + g_assert_cmpint(GGAZE_HAVE_HEIF, <=, 1); +} + +int +main(int i_argc, char **c_argv) { + g_test_init(&i_argc, &c_argv, NULL); + g_test_add_func("/bootstrap/app_id", test_app_id); + g_test_add_func("/bootstrap/version", test_version); + g_test_add_func("/bootstrap/feature_flags", test_feature_flags_are_binary); + return (g_test_run()); +}
\ No newline at end of file |
