@@ -69,20 +69,27 @@ SRCS := \
6969 oci/ref.c \
7070 oci/cli.c \
7171 oci/digest.c \
72+ oci/digest-set.c \
7273 oci/blob-store.c \
7374 oci/media-type.c \
7475 oci/manifest.c \
7576 oci/fetch.c \
7677 oci/store.c \
7778 oci/pull.c \
7879 oci/inspect.c \
80+ oci/dedup-metrics.c \
81+ oci/status.c \
82+ oci/policy.c \
7983 oci/tar.c \
8084 oci/decompress.c \
8185 oci/layer-meta.c \
8286 oci/layer-apply.c \
87+ oci/origin-meta.c \
8388 oci/volume.c \
89+ oci/volume-list.c \
8490 oci/clone-rootfs.c \
8591 oci/unpack.c \
92+ oci/rebuild-cache.c \
8693 oci/runspec.c \
8794 oci/path-resolve.c \
8895 oci/run.c
@@ -228,28 +235,64 @@ $(BUILD_DIR)/lib/oci-mock.o: CFLAGS += $(OPENSSL_CFLAGS)
228235# # test mock terminates TLS using libssl from brew openssl@3 so the ca_file
229236# # negative cases exercise a real certificate verification path.
230237$(BUILD_DIR ) /test-oci-fetch.o : CFLAGS += $(OPENSSL_CFLAGS )
231- $(BUILD_DIR ) /test-oci-fetch : $(BUILD_DIR ) /test-oci-fetch.o $(BUILD_DIR ) /lib/oci-mock.o $(BUILD_DIR ) /oci/fetch.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
238+ $(BUILD_DIR ) /test-oci-fetch : $(BUILD_DIR ) /test-oci-fetch.o $(BUILD_DIR ) /lib/oci-mock.o $(BUILD_DIR ) /oci/fetch.o $(BUILD_DIR ) /oci/policy.o $( BUILD_DIR ) /oci/ blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
232239 @echo " LD $@ "
233240 $(Q )$(CC ) $(CFLAGS ) -o $@ $^ -lcurl -lpthread $(OPENSSL_LDFLAGS )
234241
235242# # Build the OCI local store unit test (native macOS, no HVF). Pure C; links
236243# # against the store wrapper plus its blob-store, digest, and cJSON deps.
237244# # cJSON is required because store.c now reads / writes index.json.
238- $(BUILD_DIR ) /test-oci-store : $(BUILD_DIR ) /test-oci-store.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
245+ $(BUILD_DIR ) /test-oci-store : $(BUILD_DIR ) /test-oci-store.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/digest-set.o $( BUILD_DIR ) /oci/manifest.o $( BUILD_DIR ) /oci/media-type.o $( BUILD_DIR ) /oci/origin-meta.o $( BUILD_DIR ) /oci/volume-list.o $( BUILD_DIR ) /oci/ ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
239246 @echo " LD $@ "
240247 $(Q )$(CC ) $(CFLAGS ) -o $@ $^
241248
242249# # Build the OCI pull pipeline unit test (native macOS, no HVF). Shares the
243250# # TLS-terminating mock server with test-oci-fetch via tests/lib/oci-mock.
244251$(BUILD_DIR ) /test-oci-pull.o : CFLAGS += $(OPENSSL_CFLAGS )
245- $(BUILD_DIR ) /test-oci-pull : $(BUILD_DIR ) /test-oci-pull.o $(BUILD_DIR ) /lib/oci-mock.o $(BUILD_DIR ) /oci/pull.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/fetch.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
252+ $(BUILD_DIR ) /test-oci-pull : $(BUILD_DIR ) /test-oci-pull.o $(BUILD_DIR ) /lib/oci-mock.o $(BUILD_DIR ) /oci/pull.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/fetch.o $(BUILD_DIR ) /oci/policy.o $( BUILD_DIR ) /oci/ blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/digest-set.o $( BUILD_DIR ) /oci/ manifest.o $(BUILD_DIR ) /oci/media-type.o $( BUILD_DIR ) /oci/origin-meta.o $( BUILD_DIR ) /oci/volume-list .o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
246253 @echo " LD $@ "
247254 $(Q )$(CC ) $(CFLAGS ) -o $@ $^ -lcurl -lpthread $(OPENSSL_LDFLAGS )
248255
249256# # Build the OCI inspect renderer unit test (native macOS, no HVF). Pure
250257# # offline: no fetcher, no mock server, no libcurl. Pre-populates the store
251258# # via oci_blob_store_put_bytes + oci_store_put_ref.
252- $(BUILD_DIR ) /test-oci-inspect : $(BUILD_DIR ) /test-oci-inspect.o $(BUILD_DIR ) /oci/inspect.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
259+ $(BUILD_DIR ) /test-oci-inspect : $(BUILD_DIR ) /test-oci-inspect.o $(BUILD_DIR ) /oci/inspect.o $(BUILD_DIR ) /oci/dedup-metrics.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/digest-set.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/origin-meta.o $(BUILD_DIR ) /oci/volume-list.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
260+ @echo " LD $@ "
261+ $(Q )$(CC ) $(CFLAGS ) -o $@ $^
262+
263+ # # Build the OCI cross-image dedup metrics unit test (native macOS, no HVF).
264+ # # Drives oci_dedup_metrics_compute against scratch stores hand-populated
265+ # # via oci_blob_store_put_bytes + oci_store_put_ref. Same dependency set
266+ # # as test-oci-inspect, plus oci/dedup-metrics.o.
267+ $(BUILD_DIR ) /test-oci-dedup-metrics : $(BUILD_DIR ) /test-oci-dedup-metrics.o $(BUILD_DIR ) /oci/dedup-metrics.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/digest-set.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/origin-meta.o $(BUILD_DIR ) /oci/volume-list.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
268+ @echo " LD $@ "
269+ $(Q )$(CC ) $(CFLAGS ) -o $@ $^
270+
271+ # # Build the OCI rebuild-cache unit test (native macOS, no HVF). Drives
272+ # # oci_rebuild_cache against scratch stores hand-populated via oci_origin_write
273+ # # into a fixture <volume>/images/sha256-<hex>/ tree, then asserts that
274+ # # <store>/layers/stacks/sha256/<chain>/ entries are created (commit) or left
275+ # # absent (dry-run). Same dependency set as test-oci-store plus oci/rebuild-
276+ # # cache.o.
277+ $(BUILD_DIR ) /test-oci-rebuild-cache : $(BUILD_DIR ) /test-oci-rebuild-cache.o $(BUILD_DIR ) /oci/rebuild-cache.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/digest-set.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/origin-meta.o $(BUILD_DIR ) /oci/volume-list.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
278+ @echo " LD $@ "
279+ $(Q )$(CC ) $(CFLAGS ) -o $@ $^
280+
281+ # # Build the OCI store-wide status unit test (native macOS, no HVF). Drives
282+ # # oci_status_compute against scratch stores hand-populated via
283+ # # stage_image / oci_origin_write fixture helpers and asserts the aggregated
284+ # # struct fields (pin entries, unpacked entries, reachable + populated
285+ # # ratios, store totals). Same dependency set as test-oci-store plus
286+ # # oci/status.o.
287+ $(BUILD_DIR ) /test-oci-status : $(BUILD_DIR ) /test-oci-status.o $(BUILD_DIR ) /oci/status.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/digest-set.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/origin-meta.o $(BUILD_DIR ) /oci/volume-list.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
288+ @echo " LD $@ "
289+ $(Q )$(CC ) $(CFLAGS ) -o $@ $^
290+
291+ # # Build the OCI policy.json schema and loader unit test (native macOS, no HVF).
292+ # # Pure C; links against the policy translation unit plus cJSON for the JSON
293+ # # parser. Drives oci_policy_load against per-test scratch HOME / XDG / override
294+ # # trees under /tmp.
295+ $(BUILD_DIR ) /test-oci-policy : $(BUILD_DIR ) /test-oci-policy.o $(BUILD_DIR ) /oci/policy.o $(CJSON_OBJ ) | $(BUILD_DIR )
253296 @echo " LD $@ "
254297 $(Q )$(CC ) $(CFLAGS ) -o $@ $^
255298
@@ -282,7 +325,7 @@ $(BUILD_DIR)/test-oci-path-resolve: $(BUILD_DIR)/test-oci-path-resolve.o $(BUILD
282325# # the test ships an in-file elfuse_launch stub that aborts when called,
283326# # and every case installs a launch hook via oci_run_set_launch_for_testing
284327# # before invoking oci_run, so the real VM bring-up never runs from a test.
285- $(BUILD_DIR ) /test-oci-run : $(BUILD_DIR ) /test-oci-run.o $(BUILD_DIR ) /oci/run.o $(BUILD_DIR ) /oci/runspec.o $(BUILD_DIR ) /oci/path-resolve.o $(BUILD_DIR ) /oci/unpack.o $(BUILD_DIR ) /oci/volume.o $(BUILD_DIR ) /oci/clone-rootfs.o $(BUILD_DIR ) /oci/layer-apply.o $(BUILD_DIR ) /oci/layer-meta.o $(BUILD_DIR ) /oci/decompress.o $(BUILD_DIR ) /oci/tar.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/ref.o $(BUILD_DIR ) /core/sysroot.o $(BUILD_DIR ) /debug/log.o $(CJSON_OBJ ) $(ZSTD_OBJS ) | $(BUILD_DIR )
328+ $(BUILD_DIR ) /test-oci-run : $(BUILD_DIR ) /test-oci-run.o $(BUILD_DIR ) /oci/run.o $(BUILD_DIR ) /oci/runspec.o $(BUILD_DIR ) /oci/path-resolve.o $(BUILD_DIR ) /oci/unpack.o $(BUILD_DIR ) /oci/volume.o $(BUILD_DIR ) /oci/volume-list.o $( BUILD_DIR ) /oci/ clone-rootfs.o $(BUILD_DIR ) /oci/layer-apply.o $(BUILD_DIR ) /oci/layer-meta.o $(BUILD_DIR ) /oci/origin-meta.o $( BUILD_DIR ) /oci/ decompress.o $(BUILD_DIR ) /oci/tar.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $( BUILD_DIR ) /oci/digest-set .o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/ref.o $(BUILD_DIR ) /core/sysroot.o $(BUILD_DIR ) /debug/log.o $(CJSON_OBJ ) $(ZSTD_OBJS ) | $(BUILD_DIR )
286329 @echo " LD $@ "
287330 $(Q )$(CC ) $(CFLAGS ) -o $@ $^ -lz
288331
@@ -291,7 +334,7 @@ $(BUILD_DIR)/test-oci-run: $(BUILD_DIR)/test-oci-run.o $(BUILD_DIR)/oci/run.o $(
291334# # plus image-config flags. Used by tests/test-oci-compat.sh and
292335# # available standalone for one-off "shape an image from local files"
293336# # experiments.
294- $(BUILD_DIR ) /oci-fixture-builder : $(BUILD_DIR ) /lib/oci-fixture-builder.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
337+ $(BUILD_DIR ) /oci-fixture-builder : $(BUILD_DIR ) /lib/oci-fixture-builder.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/digest-set.o $( BUILD_DIR ) /oci/manifest.o $( BUILD_DIR ) /oci/media-type.o $( BUILD_DIR ) /oci/origin-meta.o $( BUILD_DIR ) /oci/volume-list.o $( BUILD_DIR ) /oci/ ref.o $(CJSON_OBJ ) | $(BUILD_DIR )
295338 @echo " LD $@ "
296339 $(Q )$(CC ) $(CFLAGS ) -o $@ $^
297340
@@ -307,6 +350,13 @@ $(BUILD_DIR)/test-oci-meta: $(BUILD_DIR)/test-oci-meta.o $(BUILD_DIR)/oci/layer-
307350 @echo " LD $@ "
308351 $(Q )$(CC ) $(CFLAGS ) -o $@ $^
309352
353+ # # Build the OCI origin sidecar unit test (native macOS, no HVF). Drives
354+ # # oci_origin_write against a tmpdir and verifies the resulting
355+ # # .elfuse-origin.json by parsing it back through cJSON.
356+ $(BUILD_DIR ) /test-oci-origin : $(BUILD_DIR ) /test-oci-origin.o $(BUILD_DIR ) /oci/origin-meta.o $(CJSON_OBJ ) | $(BUILD_DIR )
357+ @echo " LD $@ "
358+ $(Q )$(CC ) $(CFLAGS ) -o $@ $^
359+
310360# # Build the OCI layer applier unit test (native macOS, no HVF). Builds
311361# # tar payloads in memory, drives them through oci_layer_apply into a
312362# # tmp tree, and verifies filesystem state via lstat/readlink.
@@ -331,7 +381,7 @@ $(BUILD_DIR)/test-oci-clone: $(BUILD_DIR)/test-oci-clone.o $(BUILD_DIR)/oci/clon
331381# # Build the OCI unpack orchestrator integration smoke (native macOS,
332382# # no HVF). Pulls in the full Phase 2 OCI stack so the dependency
333383# # edges between modules are exercised at link time.
334- $(BUILD_DIR ) /test-oci-unpack : $(BUILD_DIR ) /test-oci-unpack.o $(BUILD_DIR ) /oci/unpack.o $(BUILD_DIR ) /oci/volume.o $(BUILD_DIR ) /oci/clone-rootfs.o $(BUILD_DIR ) /oci/layer-apply.o $(BUILD_DIR ) /oci/layer-meta.o $(BUILD_DIR ) /oci/decompress.o $(BUILD_DIR ) /oci/tar.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/ref.o $(BUILD_DIR ) /core/sysroot.o $(BUILD_DIR ) /debug/log.o $(CJSON_OBJ ) $(ZSTD_OBJS ) | $(BUILD_DIR )
384+ $(BUILD_DIR ) /test-oci-unpack : $(BUILD_DIR ) /test-oci-unpack.o $(BUILD_DIR ) /oci/unpack.o $(BUILD_DIR ) /oci/volume.o $(BUILD_DIR ) /oci/volume-list.o $( BUILD_DIR ) /oci/ clone-rootfs.o $(BUILD_DIR ) /oci/layer-apply.o $(BUILD_DIR ) /oci/layer-meta.o $(BUILD_DIR ) /oci/origin-meta.o $( BUILD_DIR ) /oci/ decompress.o $(BUILD_DIR ) /oci/tar.o $(BUILD_DIR ) /oci/store.o $(BUILD_DIR ) /oci/blob-store.o $(BUILD_DIR ) /oci/digest.o $( BUILD_DIR ) /oci/digest-set .o $(BUILD_DIR ) /oci/manifest.o $(BUILD_DIR ) /oci/media-type.o $(BUILD_DIR ) /oci/ref.o $(BUILD_DIR ) /core/sysroot.o $(BUILD_DIR ) /debug/log.o $(CJSON_OBJ ) $(ZSTD_OBJS ) | $(BUILD_DIR )
335385 @echo " LD $@ "
336386 $(Q )$(CC ) $(CFLAGS ) -o $@ $^ -lz
337387
0 commit comments