| 1 | import os |
| 2 | |
| 3 | fn run_tool(args []string) !string { |
| 4 | mut cmd := ['vinix-run'] |
| 5 | cmd << args |
| 6 | result := os.exec(cmd) |
| 7 | if result.exit_code != 0 { |
| 8 | return error('${args[0]}: ${result.output}') |
| 9 | } |
| 10 | return result.output |
| 11 | } |
| 12 | |
| 13 | page_size := run_tool(['./getconf', 'PAGESIZE'])!.trim_space().int() |
| 14 | assert page_size > 0 && (page_size & (page_size - 1)) == 0 |
| 15 | passwd := run_tool(['./getent', 'passwd', '0'])!.trim_space().split(':') |
| 16 | assert passwd.len >= 4 && passwd[2] == '0' |
| 17 | os.write_file_array('latin1.txt', [u8(0xe9)])! |
| 18 | assert run_tool(['./iconv', '-f', 'ISO-8859-1', '-t', 'UTF-8', 'latin1.txt'])! == 'é' |
| 19 | |