Pure Erlang implementation of 9p2000 protocol
filesystem fs 9p2000 erlang 9p

Tests for unfs module

hauleth.dev 26eeec84 c74dc1e5

verified
+21 -2
+21 -2
test/e9p_unfs_SUITE.erl
··· 6 6 -include_lib("common_test/include/ct.hrl"). 7 7 8 8 all() -> [ 9 - can_list_mount_content 9 + list_mount, 10 + read_file 11 + %% Ignore this test for now, as UID/GID translation is not possible 12 + %% right now until we implement 9p2000.u extension 13 + % write_to_existing_file 10 14 ]. 11 15 12 16 init_per_suite(Config) -> ··· 32 36 erlang:exit(PID, normal), 33 37 Config. 34 38 35 - can_list_mount_content(Config) -> 39 + list_mount(Config) -> 36 40 Source = ?config(source, Config), 37 41 Mount = ?config(mount, Config), 38 42 file:write_file([Source, "/bar"], "example data"), 39 43 ct:pal(Mount), 40 44 ?assertEqual(["bar"], ls(Mount)). 45 + 46 + read_file(Config) -> 47 + Source = ?config(source, Config), 48 + Mount = ?config(mount, Config), 49 + file:write_file([Source, "/bar"], "example data"), 50 + ct:pal(Mount), 51 + ?assertEqual({ok, ~"example data"}, file:read_file([Mount, "/bar"])). 52 + 53 + write_to_existing_file(Config) -> 54 + Source = ?config(source, Config), 55 + Mount = ?config(mount, Config), 56 + file:write_file([Source, "/bar"], ""), 57 + ct:pal(Mount), 58 + ok = file:write_file([Mount, "/bar"], "another data"), 59 + ?assertEqual({ok, ~"another data"}, file:read_file([Source, "/bar"])). 41 60 42 61 %% Helpers 43 62