diff --git a/CHANGELOG.md b/CHANGELOG.md index d548eb7b..5b95fac1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,12 @@ ### Added +- **openkal 0.25 一族,一次变更:openkal 0.25.0、openkal-kit 0.3.1、openkal-linux 0.26.0、openkal-macos 0.23.0、 + openkal-windows 0.21.0、openkal-emscripten 0.14.0、openkal-opensbi 0.9.0。** 规范新增 `kal_fs_hard_link`(按卷由 + `KAL_FS_PROP_HARD_LINKS` 回答,条款 11 第 59 条),`kal_process_stop_requested` 的字改为计数每次结束请求(第 60 条);一致性 + 套件按 mtest 测试协议报告,并核对实现清单的 `provides-interfaces`、`kal_interfaces()` 与导出名。各实现提供上述两项,测试改为 + mtest 的用例;openkal-emscripten 声明 `requires = ["mcpp:c-abi"]`。`tests/examples/openkal` 改用此族,新增成员 + `tests/examples/openkal-kit` 作为 kit 的直接使用者。kit 0.3.1 修正 `format_v4` 只写端口前三位数字的错误(8080 写作 080)。 - **mcpplibs.os 0.4.3.** 依赖改为同时容纳 openkal 0.24 与 0.25 两族的版本区间(openkal `>=0.24.0, <0.26.0`,各实现同理), mcpp 版本下限不变;openkal 实现以 mtest 测试自身时,经 mtest 到达 os 的图得以解析(mcpplibs/os#23)。 - **openkal-platform 0.24.5、openkal-image 0.5.4(openkal-ld、openkal-run、openkal-tools、openkal-bind)、mcpplibs.os 0.4.2, diff --git a/mcpp.toml b/mcpp.toml index 25050548..fa0312e3 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -260,6 +260,7 @@ members = [ "tests/examples/rapidcsv", "tests/examples/mcr", "tests/examples/openkal", + "tests/examples/openkal-kit", "tests/examples/openkal-musl", "tests/examples/openkal-platform", "tests/examples/compiler-rt-builtins", diff --git a/pkgs/o/openkal-emscripten.lua b/pkgs/o/openkal-emscripten.lua index 51615a8a..afec6153 100644 --- a/pkgs/o/openkal-emscripten.lua +++ b/pkgs/o/openkal-emscripten.lua @@ -46,6 +46,13 @@ package = { xpm = { linux = { + ["0.14.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.14.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.14.0/openkal-emscripten-0.14.0.tar.gz", + }, + sha256 = "d8d9e4b437bc0deeccab274d54a6f99eba7b9e77b9333c22377949893d5e7aab", + }, ["0.13.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.13.0.tar.gz", @@ -153,6 +160,13 @@ package = { }, }, macosx = { + ["0.14.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.14.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.14.0/openkal-emscripten-0.14.0.tar.gz", + }, + sha256 = "d8d9e4b437bc0deeccab274d54a6f99eba7b9e77b9333c22377949893d5e7aab", + }, ["0.13.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.13.0.tar.gz", @@ -260,6 +274,13 @@ package = { }, }, windows = { + ["0.14.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.14.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.14.0/openkal-emscripten-0.14.0.tar.gz", + }, + sha256 = "d8d9e4b437bc0deeccab274d54a6f99eba7b9e77b9333c22377949893d5e7aab", + }, ["0.13.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.13.0.tar.gz", diff --git a/pkgs/o/openkal-kit.lua b/pkgs/o/openkal-kit.lua index fed237c5..6f3559c5 100644 --- a/pkgs/o/openkal-kit.lua +++ b/pkgs/o/openkal-kit.lua @@ -41,6 +41,13 @@ package = { xpm = { linux = { + ["0.3.1"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/kit-0.3.1.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/kit-0.3.1/openkal-kit-0.3.1.tar.gz", + }, + sha256 = "81cea3b8a749089a39bfbed4dfa7a90603383152120a8b88c81fd4d206880a8d", + }, ["0.2.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/kit-0.2.0.tar.gz", @@ -57,6 +64,13 @@ package = { }, }, macosx = { + ["0.3.1"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/kit-0.3.1.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/kit-0.3.1/openkal-kit-0.3.1.tar.gz", + }, + sha256 = "81cea3b8a749089a39bfbed4dfa7a90603383152120a8b88c81fd4d206880a8d", + }, ["0.2.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/kit-0.2.0.tar.gz", @@ -73,6 +87,13 @@ package = { }, }, windows = { + ["0.3.1"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/kit-0.3.1.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/kit-0.3.1/openkal-kit-0.3.1.tar.gz", + }, + sha256 = "81cea3b8a749089a39bfbed4dfa7a90603383152120a8b88c81fd4d206880a8d", + }, ["0.2.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/kit-0.2.0.tar.gz", diff --git a/pkgs/o/openkal-linux.lua b/pkgs/o/openkal-linux.lua index 042c3c5e..13d1394b 100644 --- a/pkgs/o/openkal-linux.lua +++ b/pkgs/o/openkal-linux.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.26.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.26.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.26.0/openkal-linux-0.26.0.tar.gz", + }, + sha256 = "07b9a68742a3d40a9d74cf1a60f9dabb73ebebf594d4321333fa9ac88dccaa49", + }, ["0.25.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.25.0.tar.gz", @@ -245,6 +252,13 @@ package = { }, }, macosx = { + ["0.26.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.26.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.26.0/openkal-linux-0.26.0.tar.gz", + }, + sha256 = "07b9a68742a3d40a9d74cf1a60f9dabb73ebebf594d4321333fa9ac88dccaa49", + }, ["0.25.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.25.0.tar.gz", @@ -471,6 +485,13 @@ package = { }, }, windows = { + ["0.26.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.26.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.26.0/openkal-linux-0.26.0.tar.gz", + }, + sha256 = "07b9a68742a3d40a9d74cf1a60f9dabb73ebebf594d4321333fa9ac88dccaa49", + }, ["0.25.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.25.0.tar.gz", diff --git a/pkgs/o/openkal-macos.lua b/pkgs/o/openkal-macos.lua index 6c552975..afdb2b3f 100644 --- a/pkgs/o/openkal-macos.lua +++ b/pkgs/o/openkal-macos.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.23.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.23.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.23.0/openkal-macos-0.23.0.tar.gz", + }, + sha256 = "b1a061939bd99b8a888182223f1e68c9a2e036266af34569d5c4307abc2d151c", + }, ["0.22.1"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.22.1.tar.gz", @@ -259,6 +266,13 @@ package = { }, }, macosx = { + ["0.23.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.23.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.23.0/openkal-macos-0.23.0.tar.gz", + }, + sha256 = "b1a061939bd99b8a888182223f1e68c9a2e036266af34569d5c4307abc2d151c", + }, ["0.22.1"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.22.1.tar.gz", @@ -499,6 +513,13 @@ package = { }, }, windows = { + ["0.23.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.23.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.23.0/openkal-macos-0.23.0.tar.gz", + }, + sha256 = "b1a061939bd99b8a888182223f1e68c9a2e036266af34569d5c4307abc2d151c", + }, ["0.22.1"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.22.1.tar.gz", diff --git a/pkgs/o/openkal-opensbi.lua b/pkgs/o/openkal-opensbi.lua index 419f1363..9facaaf3 100644 --- a/pkgs/o/openkal-opensbi.lua +++ b/pkgs/o/openkal-opensbi.lua @@ -20,6 +20,13 @@ package = { xpm = { linux = { + ["0.9.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.9.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-opensbi/releases/download/0.9.0/openkal-opensbi-0.9.0.tar.gz", + }, + sha256 = "70bf7414283bb431bf1d1db05f75e432bf1187d60e7000063bb7d103088576a7", + }, ["0.8.3"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.8.3.tar.gz", @@ -127,6 +134,13 @@ package = { }, }, macosx = { + ["0.9.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.9.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-opensbi/releases/download/0.9.0/openkal-opensbi-0.9.0.tar.gz", + }, + sha256 = "70bf7414283bb431bf1d1db05f75e432bf1187d60e7000063bb7d103088576a7", + }, ["0.8.3"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.8.3.tar.gz", @@ -234,6 +248,13 @@ package = { }, }, windows = { + ["0.9.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.9.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-opensbi/releases/download/0.9.0/openkal-opensbi-0.9.0.tar.gz", + }, + sha256 = "70bf7414283bb431bf1d1db05f75e432bf1187d60e7000063bb7d103088576a7", + }, ["0.8.3"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.8.3.tar.gz", diff --git a/pkgs/o/openkal-windows.lua b/pkgs/o/openkal-windows.lua index 30963148..dc1ba4fc 100644 --- a/pkgs/o/openkal-windows.lua +++ b/pkgs/o/openkal-windows.lua @@ -21,6 +21,13 @@ package = { xpm = { linux = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.21.0/openkal-windows-0.21.0.tar.gz", + }, + sha256 = "585370e929875f996ec0283695c3d7768ce00f4c126be1c0cbd6d40ef1cc0757", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.20.0.tar.gz", @@ -254,6 +261,13 @@ package = { }, }, macosx = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.21.0/openkal-windows-0.21.0.tar.gz", + }, + sha256 = "585370e929875f996ec0283695c3d7768ce00f4c126be1c0cbd6d40ef1cc0757", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.20.0.tar.gz", @@ -487,6 +501,13 @@ package = { }, }, windows = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.21.0/openkal-windows-0.21.0.tar.gz", + }, + sha256 = "585370e929875f996ec0283695c3d7768ce00f4c126be1c0cbd6d40ef1cc0757", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.20.0.tar.gz", diff --git a/pkgs/o/openkal.lua b/pkgs/o/openkal.lua index 7eefa7f8..aab2946b 100644 --- a/pkgs/o/openkal.lua +++ b/pkgs/o/openkal.lua @@ -22,6 +22,13 @@ package = { xpm = { linux = { + ["0.25.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.25.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.25.0/openkal-0.25.0.tar.gz", + }, + sha256 = "5dd0e82bd150562bd26824f515698d45e71157adcbe97289b28c3e399acc0771", + }, ["0.24.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.24.0.tar.gz", @@ -192,6 +199,13 @@ package = { }, }, macosx = { + ["0.25.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.25.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.25.0/openkal-0.25.0.tar.gz", + }, + sha256 = "5dd0e82bd150562bd26824f515698d45e71157adcbe97289b28c3e399acc0771", + }, ["0.24.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.24.0.tar.gz", @@ -362,6 +376,13 @@ package = { }, }, windows = { + ["0.25.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.25.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.25.0/openkal-0.25.0.tar.gz", + }, + sha256 = "5dd0e82bd150562bd26824f515698d45e71157adcbe97289b28c3e399acc0771", + }, ["0.24.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.24.0.tar.gz", diff --git a/tests/examples/openkal-kit/mcpp.toml b/tests/examples/openkal-kit/mcpp.toml new file mode 100644 index 00000000..40101ca9 --- /dev/null +++ b/tests/examples/openkal-kit/mcpp.toml @@ -0,0 +1,26 @@ +# openkal-kit test project: the facilities composed from openkal's interfaces, +# consumed as a program consumes them --- the kit, the specification it is +# written against, and the implementation for this system. The observation is +# of behaviour (tests/kit.cpp): an endpoint is parsed and written back, and a +# malformed one is refused. +[package] +name = "openkal-kit-tests" +version = "0.1.0" + +[dependencies.mcpplibs] +openkal = "0.25.0" +openkal-kit = "0.3.1" + +[target.'cfg(os = "linux")'.dependencies.mcpplibs] +openkal-linux = "0.26.0" + +[target.'cfg(os = "macos")'.dependencies.mcpplibs] +openkal-macos = "0.23.0" + +[target.'cfg(windows)'.dependencies.mcpplibs] +openkal-windows = "0.21.0" + +# This member names mcpplibs packages, which the workspace root's single +# redirect does not carry, so it states its own. +[indices] +mcpplibs = { path = "../../.." } diff --git a/tests/examples/openkal-kit/tests/kit.cpp b/tests/examples/openkal-kit/tests/kit.cpp new file mode 100644 index 00000000..519abb6d --- /dev/null +++ b/tests/examples/openkal-kit/tests/kit.cpp @@ -0,0 +1,24 @@ +// openkal-kit through the index: an endpoint parsed, written back and refused +// when malformed, which is the kit's behaviour and not only its declarations. +#include +#include +import openkal.types; +import openkal.kit.endpoint; + +int main() { + using namespace kal::kit; + int failures = 0; + auto check = [&](bool held, const char* what) { + if (!held) { std::printf("FAIL: %s\n", what); ++failures; } + }; + const auto r = parse_v4("127.0.0.1:8080", 14); + check(r.ok && r.ep.addr_len == 4 && r.ep.port == 8080, "an address with a port parses"); + char out[32]; + const auto f = format_v4(r.ep, out, sizeof out); + check(f.ok && f.n == 14 && std::memcmp(out, "127.0.0.1:8080", 14) == 0, + "and is written back as it was given"); + check(!parse_v4("256.0.0.1", 9).ok, "an octet past 255 is refused"); + check(!parse_v4("1.2.3", 5).ok, "three octets are refused"); + if (failures == 0) std::printf("openkal-kit: an endpoint parsed, written back and refused\n"); + return failures == 0 ? 0 : 1; +} diff --git a/tests/examples/openkal/mcpp.toml b/tests/examples/openkal/mcpp.toml index 666f8864..bb182f98 100644 --- a/tests/examples/openkal/mcpp.toml +++ b/tests/examples/openkal/mcpp.toml @@ -18,25 +18,25 @@ name = "openkal-tests" version = "0.1.0" [dependencies.mcpplibs] -openkal = "0.24.0" +openkal = "0.25.0" [target.'cfg(os = "linux")'.dependencies.mcpplibs] -openkal-linux = "0.25.0" +openkal-linux = "0.26.0" [target.'cfg(os = "macos")'.dependencies.mcpplibs] -openkal-macos = "0.22.1" +openkal-macos = "0.23.0" [target.'cfg(windows)'.dependencies.mcpplibs] -openkal-windows = "0.20.0" +openkal-windows = "0.21.0" [target.'cfg(all(os = "linux", env = "musl"))'.dependencies.mcpplibs] openkal-llvm-runtime = "0.19.2" [target.'cfg(arch = "wasm32")'.dependencies.mcpplibs] -openkal-emscripten = "0.13.0" +openkal-emscripten = "0.14.0" [target.'cfg(arch = "riscv64")'.dependencies.mcpplibs] -openkal-opensbi = "0.8.3" +openkal-opensbi = "0.9.0" # This member names mcpplibs packages, which the workspace root's single # redirect does not carry, so it states its own (mcpp.toml at the root says why diff --git a/tests/examples/openkal/tests/kal.cpp b/tests/examples/openkal/tests/kal.cpp index e3de277b..be8d502b 100644 --- a/tests/examples/openkal/tests/kal.cpp +++ b/tests/examples/openkal/tests/kal.cpp @@ -17,7 +17,8 @@ // (0.22) the null device beside a stream at one position is refused, and is // refused as unsupported where the implementation does not state it; (0.23) a // region at an address, zero; a read-only attenuation; the machine's memory -// and the resource preference. +// and the resource preference; (0.25) where the volume states it, a second name +// for a file reads as the first, and a name that is taken is refused. // The terminal is not observed here, // because a test run has none; the implementations observe it on a terminal // they make. @@ -109,6 +110,25 @@ int main() { kal_fs_remove(root, "okt.a", 5); kal_fs_remove(root, "okt.b", 5); } + if (root.h && (kal_fs_props(root) & KAL_FS_PROP_HARD_LINKS) != 0) { + kal_file f{}; + if (kal_fs_open(root, "okt.h", 5, KAL_OPEN_WRITE | KAL_OPEN_CREATE | KAL_OPEN_TRUNCATE, &f) == kal_ok) { + kal_stream_write(kal_fs_stream(f), "linked", 6); + kal_fs_close_file(f); + } + check(kal_fs_hard_link(root, "okt.h", 5, root, "okt.l", 5) == kal_ok, "a file is given a second name"); + char b[8] = {}; + kal_file g{}; + if (kal_fs_open(root, "okt.l", 5, KAL_OPEN_READ, &g) == kal_ok) { + check(kal_stream_read(kal_fs_stream(g), b, sizeof b) == 6 && b[0] == 'l' && b[5] == 'd', + "and the second name reads as the first"); + kal_fs_close_file(g); + } + check(kal_fs_hard_link(root, "okt.h", 5, root, "okt.l", 5) == kal_err_exists, + "a second name that is taken is refused"); + kal_fs_remove(root, "okt.l", 5); + kal_fs_remove(root, "okt.h", 5); + } if ((kal_process_props() & KAL_PROCESS_PROP_ONE_STRING) == 0 && root.h) { // Where a program receives a vector, a joined command line has no