.githooks/
compiler/
kernel/
lib/
scripts/
seed/
sublime/
test/
boot/
bootstrap/
compiler/
cycles/
dispatch/
format/
host/
integration/
fixtures/
boot.rad
11.3 KiB
fixtures.rad
12.9 KiB
format.rad
7.7 KiB
harness.rad
23.0 KiB
host.rad
9.8 KiB
integration.manifest
506 B
integration.rad
5.5 KiB
kernel.rad
6.0 KiB
linking.rad
1.7 KiB
machine.rad
9.1 KiB
packages.rad
45.3 KiB
verify.rad
7.2 KiB
kernel/
loader/
manifests/
mmio/
native/
packages/
runtime/
scheduling/
shared/
slots/
smp/
std/
sync/
termination/
tests/
trap/
verify/
Makefile
9.2 KiB
kernel.rad
776 B
runner.rad
11.6 KiB
vim/
.gitignore
333 B
.gitsigners
224 B
AGENTS.md
8.3 KiB
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
2.5 KiB
README
3.4 KiB
STYLE
3.2 KiB
std.lib
2.1 KiB
std.lib.test
1.1 KiB
test/integration/linking.rad
raw
| 1 | //! Deterministic exact package identities and implementation updates. |
| 2 | |
| 3 | use std::fs; |
| 4 | use std::io; |
| 5 | use std::lang::il::binary; |
| 6 | use std::lang::il::binary::program; |
| 7 | use std::sys; |
| 8 | use super::harness; |
| 9 | use super::harness::Harness; |
| 10 | |
| 11 | /// Compile repeated and body-changed package images. |
| 12 | export fn check(h: &mut Harness) throws (sys::Error) { |
| 13 | try h.begin("linking"); |
| 14 | let mut packages: *mut [binary::Package] = &mut []; |
| 15 | for name, i in &["first", "body", "repeat"] { |
| 16 | let directory = h.path(&[name]); |
| 17 | try harness::makeDirs(directory); |
| 18 | let source = h.join(&[directory, "/support.rad"]); |
| 19 | let body = "1" if i == 1 else "0"; |
| 20 | try fs::writeFileParts( |
| 21 | source, |
| 22 | &[ |
| 23 | "/// Public nominal value.\nexport record Value: Copy {\n", |
| 24 | " /// Payload.\n value: u32,\n}\n", |
| 25 | "/// Read the payload.\nexport fn read(input: &Value) -> u32 {\n", |
| 26 | " return input.value + ", body, ";\n}\n", |
| 27 | ] |
| 28 | ); |
| 29 | h.add(&["-pkg", "support", "-mod", source, "-ril", directory]); |
| 30 | if not h.compile(h.join(&["compile package ", name]), h.out(&[name, ".log"])) { |
| 31 | return; |
| 32 | } |
| 33 | let wire = try h.load(h.join(&[directory, "/support/support.ril.bin"])); |
| 34 | let decoded = try! program::decode(wire, h.arena, binary::Limits { |
| 35 | registers: 1024, blocks: 1024 |
| 36 | }); |
| 37 | try! packages.append(decoded, h.arena); |
| 38 | } |
| 39 | assert packages[0].links.image <> packages[1].links.image; |
| 40 | assert packages[0].links.image == packages[2].links.image; |
| 41 | h.pass(); |
| 42 | io::printLn( |
| 43 | "package identities: deterministic images and body updates passed" |
| 44 | ); |
| 45 | } |