diff options
Diffstat (limited to 'tests/drivers/image_growth_test.py')
| -rw-r--r-- | tests/drivers/image_growth_test.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/drivers/image_growth_test.py b/tests/drivers/image_growth_test.py new file mode 100644 index 0000000..064eae7 --- /dev/null +++ b/tests/drivers/image_growth_test.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# image output can grow past its first buffer and the building host's genome slot. +import pathlib +import subprocess +import sys + +root = pathlib.Path(__file__).resolve().parents[2] +source = '''fn main() { + int retained = 7; + int n = build_image_grow(GORG, 8); + gc(); + put_n(n > FBOT - GORG); put_c(32); + put_n(image_size == n && image_words[6] == GORG + n); put_c(32); + put_n(image_words[5] > GORG && image_words[5] < image_words[6]); put_c(32); + put_n(retained); put_c(10); + return 0; +} +`''' +source += (root / 'src/runtime/rt.zc').read_text() +source += (root / 'src/runtime/run.zc').read_text() +source += 'let padding[350000]; fn main() { return padding[349999]; }\n' +result = subprocess.run(sys.argv[1:], input=source, capture_output=True, text=True, timeout=40) +assert result.returncode == 0, (result.stdout, result.stderr) +assert result.stdout == '1 1 1 7\n', result.stdout[:1000] +print('ok growing image output keeps logical addresses and older frames intact') |
