Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/mk/osh-host.mk # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / mk / osh-host.mk` 70 lines ยท 5535 bytes Raw Blame History 1 # osh Linux host adapter (aien-architecture#158): execution service. Picked up by `-include mk/*.mk`; not part of `all` or `test`. 2 # Host code is replaceable scaffolding (ADR 0024); the shell language core lives in src/osh/*.osc. 3 # make test-osh-host build + run tests/osh/host/test_osh_host.c plain and under ASan/UBSan 4 ifndef OSH_HOST_MK 5 OSH_HOST_MK := 1 6 .PHONY: test-osh-host 7 OSH_HOST_DIR = $(OUT_DIR)/osh-host 8 OSH_HOST_SRCS = tests/osh/host/test_osh_host.c src/osh/host/osh_req.c src/osh/host/osh_vars.c \ 9 src/osh/host/osh_builtin.c src/osh/host/osh_exec.c src/osh/host/osh_journal.c src/omega_om_units.c 10 OSH_HOST_HDRS = src/osh/host/osh_host.h src/osh/host/osh_priv.h src/osh/host/osh_journal.h src/sha256.h 11 OSH_HOST_FLAGS = -std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -Isrc/osh/host -Isrc 12 OSH_HOST_ASAN = -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all 13 14 $(OSH_HOST_DIR)/test_osh_host: $(OSH_HOST_SRCS) $(OSH_HOST_HDRS) 15 @mkdir -p $(OSH_HOST_DIR) 16 $(CC) $(OSH_HOST_FLAGS) -O2 -o $@ $(OSH_HOST_SRCS) 17 18 $(OSH_HOST_DIR)/test_osh_host_asan: $(OSH_HOST_SRCS) $(OSH_HOST_HDRS) 19 @mkdir -p $(OSH_HOST_DIR) 20 $(CC) $(OSH_HOST_FLAGS) $(OSH_HOST_ASAN) -o $@ $(OSH_HOST_SRCS) 21 22 test-osh-host: $(OSH_HOST_DIR)/test_osh_host $(OSH_HOST_DIR)/test_osh_host_asan 23 $(abspath $(OSH_HOST_DIR)/test_osh_host) > $(OSH_HOST_DIR)/host.out; rc=$$?; tail -5 $(OSH_HOST_DIR)/host.out; test $$rc -eq 0 && tail -1 $(OSH_HOST_DIR)/host.out | grep -q '^OSH_HOST_PASS$$' 24 $(abspath $(OSH_HOST_DIR)/test_osh_host_asan) > $(OSH_HOST_DIR)/host_asan.out; rc=$$?; tail -3 $(OSH_HOST_DIR)/host_asan.out; test $$rc -eq 0 && tail -1 $(OSH_HOST_DIR)/host_asan.out | grep -q '^OSH_HOST_PASS$$' 25 @echo "test-osh-host: PASS (execution service; plain and ASan/UBSan)" 26 27 # capability enforcement (src/osh/host/osh_caps.c on omega's rx_caproot): allowed/denied effects with negative controls, 28 # revoke, stale and 64-bit generations, forged principals, and the same properties through `osh --caps`. 29 # make test-osh-caps plain and under ASan/UBSan 30 .PHONY: test-osh-caps 31 OSH_CAPS_SRCS = tests/osh/host/test_osh_caps.c src/osh/host/osh_caps.c src/runtime/rx_caproot.c src/osh/host/osh_req.c \ 32 src/osh/host/osh_vars.c src/osh/host/osh_builtin.c src/osh/host/osh_exec.c src/osh/host/osh_journal.c src/omega_om_units.c 33 OSH_CAPS_HDRS = $(OSH_HOST_HDRS) src/osh/host/osh_caps.h src/runtime/rx_caproot.h 34 OSH_CAPS_FLAGS = $(OSH_HOST_FLAGS) -Isrc/runtime -Wno-format-truncation 35 36 $(OSH_HOST_DIR)/test_osh_caps: $(OSH_CAPS_SRCS) $(OSH_CAPS_HDRS) 37 @mkdir -p $(OSH_HOST_DIR) 38 $(CC) $(OSH_CAPS_FLAGS) -O2 -o $@ $(OSH_CAPS_SRCS) 39 40 $(OSH_HOST_DIR)/test_osh_caps_asan: $(OSH_CAPS_SRCS) $(OSH_CAPS_HDRS) 41 @mkdir -p $(OSH_HOST_DIR) 42 $(CC) $(OSH_CAPS_FLAGS) $(OSH_HOST_ASAN) -o $@ $(OSH_CAPS_SRCS) 43 44 test-osh-caps: $(OSH_HOST_DIR)/test_osh_caps $(OSH_HOST_DIR)/test_osh_caps_asan $(OUT_DIR)/osh/osh 45 rm -rf $(abspath $(OSH_HOST_DIR))/state; XDG_STATE_HOME=$(abspath $(OSH_HOST_DIR))/state $(abspath $(OSH_HOST_DIR)/test_osh_caps) $(abspath $(OUT_DIR)/osh/osh) > $(OSH_HOST_DIR)/caps.out; rc=$$?; tail -5 $(OSH_HOST_DIR)/caps.out; test $$rc -eq 0 && tail -1 $(OSH_HOST_DIR)/caps.out | grep -q '^OSH_CAPS_PASS$$' 46 rm -rf $(abspath $(OSH_HOST_DIR))/state; XDG_STATE_HOME=$(abspath $(OSH_HOST_DIR))/state $(abspath $(OSH_HOST_DIR)/test_osh_caps_asan) $(abspath $(OUT_DIR)/osh/osh) > $(OSH_HOST_DIR)/caps_asan.out; rc=$$?; tail -3 $(OSH_HOST_DIR)/caps_asan.out; test $$rc -eq 0 && tail -1 $(OSH_HOST_DIR)/caps_asan.out | grep -q '^OSH_CAPS_PASS$$' 47 @echo "test-osh-caps: PASS (capability enforcement; plain and ASan/UBSan)" 48 # durable intent/outcome journal (ABI section 10): intent before each effect, outcome after, recovery never replays. 49 # make test-osh-journal plain and under ASan/UBSan 50 .PHONY: test-osh-journal 51 OSH_JOURNAL_SRCS = tests/osh/host/test_osh_journal.c src/osh/host/osh_req.c src/osh/host/osh_vars.c src/osh/host/osh_builtin.c \ 52 src/osh/host/osh_exec.c src/osh/host/osh_journal.c src/omega_om_units.c 53 54 $(OSH_HOST_DIR)/test_osh_journal: $(OSH_JOURNAL_SRCS) $(OSH_HOST_HDRS) 55 @mkdir -p $(OSH_HOST_DIR) 56 $(CC) $(OSH_HOST_FLAGS) -DOSH_JOURNAL_TEST_HOOKS -O2 -o $@ $(OSH_JOURNAL_SRCS) 57 58 $(OSH_HOST_DIR)/test_osh_journal_asan: $(OSH_JOURNAL_SRCS) $(OSH_HOST_HDRS) 59 @mkdir -p $(OSH_HOST_DIR) 60 $(CC) $(OSH_HOST_FLAGS) -DOSH_JOURNAL_TEST_HOOKS $(OSH_HOST_ASAN) -o $@ $(OSH_JOURNAL_SRCS) 61 62 test-osh-journal: $(OSH_HOST_DIR)/test_osh_journal $(OSH_HOST_DIR)/test_osh_journal_asan $(OUT_DIR)/osh/osh 63 @nm $(OUT_DIR)/osh/osh | grep -q osh_journal_intent || { echo "FAIL: shipped osh is stripped, cannot check"; exit 1; } 64 @if nm $(OUT_DIR)/osh/osh | grep -q osh_journal_test_hooks_compiled; then echo "FAIL: shipped osh contains the journal test hooks"; exit 1; fi 65 @nm $(abspath $(OSH_HOST_DIR)/test_osh_journal) | grep -q osh_journal_test_hooks_compiled || { echo "FAIL: test build lacks the hooks"; exit 1; } 66 @echo "test hooks: absent from the shipped osh, present in the test build" 67 $(abspath $(OSH_HOST_DIR)/test_osh_journal) $(abspath $(OUT_DIR)/osh/osh) > $(OSH_HOST_DIR)/journal.out; rc=$$?; tail -5 $(OSH_HOST_DIR)/journal.out; test $$rc -eq 0 && tail -1 $(OSH_HOST_DIR)/journal.out | grep -q '^OSH_JOURNAL_PASS$$' 68 $(abspath $(OSH_HOST_DIR)/test_osh_journal_asan) $(abspath $(OUT_DIR)/osh/osh) > $(OSH_HOST_DIR)/journal_asan.out; rc=$$?; tail -3 $(OSH_HOST_DIR)/journal_asan.out; test $$rc -eq 0 && tail -1 $(OSH_HOST_DIR)/journal_asan.out | grep -q '^OSH_JOURNAL_PASS$$' 69 @echo "test-osh-journal: PASS (durable intent/outcome journal; plain and ASan/UBSan)" 70 endif