1: -module(migration_scripts_SUITE). 2: 3: % CT callbacks 4: -export([all/0, groups/0, init_per_suite/1, end_per_suite/1]). 5: % sender-jid-from-mam-message.escript test cases 6: -export([ 7: sender_jid_from_mam_muc_eterm_stream/1, 8: sender_jid_from_mam_muc_xml_stream/1, 9: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_eterm_input/1, 10: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_xml_input/1, 11: sender_jid_from_mam_muc_doesnt_crash_on_malformed_eterm_input/1, 12: sender_jid_from_mam_muc_doesnt_crash_on_malformed_xml_input/1 13: ]). 14: 15: %% ---------------------------------------------------------- 16: %% CT callbacks 17: %% ---------------------------------------------------------- 18: 19: all() -> 20: [ 21: {group, sender_jid_from_mam_message} 22: ]. 23: 24: groups() -> 25: [ 26: {sender_jid_from_mam_message, [parallel], [ 27: sender_jid_from_mam_muc_eterm_stream, 28: sender_jid_from_mam_muc_xml_stream, 29: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_eterm_input, 30: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_xml_input, 31: sender_jid_from_mam_muc_doesnt_crash_on_malformed_eterm_input, 32: sender_jid_from_mam_muc_doesnt_crash_on_malformed_xml_input 33: ]} 34: ]. 35: 36: init_per_suite(Config) -> 37: file:delete("/tmp/script-debug"), 38: {ok, _} = application:ensure_all_started(jid), 39: Config. 40: 41: end_per_suite(Config) -> 42: {ok, DebugData} = file:read_file("/tmp/script-debug"), 43: ct:pal("~p", [DebugData]), 44: Config. 45: 46: %% ---------------------------------------------------------- 47: %% Test cases 48: %% ---------------------------------------------------------- 49: 50: %% ----------------- sender-jid-from-mam-message.escript ---------------------- 51: 52: sender_jid_from_mam_muc_eterm_stream(Config) -> 53: Port = script_helper:start("tools/migration/sender-jid-from-mam-message.escript", 54: ["eterm", filename:join(small_path_helper:repo_dir(Config), 55: "tools/migration/sender-jid-from-mam-message.example.eterm")]), 56: sender_jid_from_mam_muc_data_stream(Port). 57: 58: sender_jid_from_mam_muc_xml_stream(Config) -> 59: Port = script_helper:start("tools/migration/sender-jid-from-mam-message.escript", 60: ["xml", filename:join(small_path_helper:repo_dir(Config), 61: "tools/migration/sender-jid-from-mam-message.example.xml")]), 62: sender_jid_from_mam_muc_data_stream(Port). 63: 64: sender_jid_from_mam_muc_data_stream(Port) -> 65: BareJID = <<"gżegżółka@brzęczyszczykiewicz.pl"/utf8>>, 66: BareJID = script_helper:read(Port). 67: 68: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_eterm_input(Config) -> 69: Port = script_helper:start("tools/migration/sender-jid-from-mam-message.escript", 70: ["eterm", filename:join(small_path_helper:repo_dir(Config), 71: "tools/migration/unsupported_input.example.eterm")]), 72: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_input(Port). 73: 74: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_xml_input(Config) -> 75: Port = script_helper:start("tools/migration/sender-jid-from-mam-message.escript", 76: ["xml", filename:join(small_path_helper:repo_dir(Config), 77: "tools/migration/unsupported_input.example.xml")]), 78: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_input(Port). 79: 80: 81: sender_jid_from_mam_muc_doesnt_crash_on_malformed_eterm_input(Config) -> 82: Port = script_helper:start("tools/migration/sender-jid-from-mam-message.escript", 83: ["eterm", filename:join(small_path_helper:repo_dir(Config), 84: "tools/migration/malformed_input.example.eterm")]), 85: sender_jid_from_mam_muc_doesnt_crash_on_malformed_input(Port). 86: 87: sender_jid_from_mam_muc_doesnt_crash_on_malformed_xml_input(Config) -> 88: Port = script_helper:start("tools/migration/sender-jid-from-mam-message.escript", 89: ["xml", filename:join(small_path_helper:repo_dir(Config), 90: "tools/migration/malformed_input.example.xml")]), 91: sender_jid_from_mam_muc_doesnt_crash_on_malformed_input(Port). 92: 93: sender_jid_from_mam_muc_doesnt_crash_on_unsupported_input(Port) -> 94: {error, -2} = script_helper:read(Port). 95: 96: sender_jid_from_mam_muc_doesnt_crash_on_malformed_input(Port) -> 97: {error, -1} = script_helper:read(Port).