檢視原始碼 ct_master (common_test v1.27.5)

用於 Common Test 的分散式測試執行控制。

此模組匯出函數,用於在多個主機上並行執行 Common Test 節點。

摘要

類型

要執行的測試規範的檔案名稱。

函數

停止所有正在執行的測試。

停止指定節點上的測試。

如果設定為 true,則 ct_master 日誌將以原始 HTML 格式寫入,而不是使用 Common Test CSS 樣式表。

取得 Common Test 主事件管理器的參考。此參考可用於在測試執行時,例如新增使用者特定的事件處理程序。

傳回測試進度。如果 Statusongoing,則表示測試正在節點上執行且尚未完成。

TestSpecs 中指定,在衍生節點上執行測試(請參閱 run/4)。

測試會如 TestSpecs 中指定在節點上衍生。 TestSpec 中的每個規範都會被個別處理。然而,也可以指定一個規範列表,在執行測試之前將其合併為一個規範。任何沒有特定節點規範的測試也會在 InclNodes 中的節點上執行。 ExclNodes 列表中的節點會從測試中排除。

測試會根據 TestSpecsNode 上衍生。

使用 ct:run_test/1Node 上衍生測試。

類型

-type test_spec() :: file:name_all().

要執行的測試規範的檔案名稱。

函數

-spec abort() -> ok.

停止所有正在執行的測試。

-spec abort(Nodes) -> ok when Nodes :: Node | [Node], Node :: node().

停止指定節點上的測試。

連結到此函數

basic_html(Bool)

檢視原始碼 (自 OTP R15B01 起)
-spec basic_html(Bool) -> ok when Bool :: boolean().

如果設定為 true,則 ct_master 日誌將以原始 HTML 格式寫入,而不是使用 Common Test CSS 樣式表。

連結到此函數

get_event_mgr_ref()

檢視原始碼 (自 OTP 17.5 起)
-spec get_event_mgr_ref() -> atom().

取得 Common Test 主事件管理器的參考。此參考可用於在測試執行時,例如新增使用者特定的事件處理程序。

範例

gen_event:add_handler(ct_master:get_event_mgr_ref(), my_ev_h, [])
-spec progress() -> [{Node, Status}] when Node :: node(), Status :: atom().

傳回測試進度。如果 Statusongoing,則表示測試正在節點上執行且尚未完成。

-spec run(TestSpecs) -> [{Specs, ok} | {error, Reason}]
             when
                 TestSpecs :: TestSpec | [TestSpec] | [[TestSpec]],
                 TestSpec :: test_spec(),
                 Specs :: [file:filename_all()],
                 Reason :: term().

TestSpecs 中指定,在衍生節點上執行測試(請參閱 run/4)。

如果呼叫時 TestSpecs 是字串列表,則等同於 run(TestSpecs, false, [], [])

如果呼叫時 TS 是字串,則等同於 run([TS], false, [], [])

連結到此函數

run(TestSpecs, InclNodes, ExclNodes)

檢視原始碼
-spec run(TestSpecs, InclNodes, ExclNodes) -> [{Specs, ok} | {error, Reason}]
             when
                 TestSpecs :: TestSpec | [TestSpec] | [[TestSpec]],
                 TestSpec :: test_spec(),
                 InclNodes :: [node()],
                 ExclNodes :: [node()],
                 Specs :: [file:filename_all()],
                 Reason :: term().

等同於 run(TestSpecs, false, InclNodes, ExclNodes)

連結到此函數

run(TestSpecs, AllowUserTerms, InclNodes, ExclNodes)

檢視原始碼
-spec run(TestSpecs, AllowUserTerms, InclNodes, ExclNodes) -> [{Specs, ok} | {error, Reason}]
             when
                 TestSpecs :: TestSpec | [TestSpec] | [[TestSpec]],
                 TestSpec :: test_spec(),
                 AllowUserTerms :: boolean(),
                 InclNodes :: [node()],
                 ExclNodes :: [node()],
                 Specs :: [file:filename_all()],
                 Reason :: term().

測試會如 TestSpecs 中指定在節點上衍生。 TestSpec 中的每個規範都會被個別處理。然而,也可以指定一個規範列表,在執行測試之前將其合併為一個規範。任何沒有特定節點規範的測試也會在 InclNodes 中的節點上執行。 ExclNodes 列表中的節點會從測試中排除。

連結到此函數

run_on_node(TestSpecs, Node)

檢視原始碼
-spec run_on_node(TestSpecs, Node) -> [{Specs, ok} | {error, Reason}]
                     when
                         TestSpecs :: TestSpec | [TestSpec] | [[TestSpec]],
                         TestSpec :: test_spec(),
                         Node :: node(),
                         Specs :: [file:filename_all()],
                         Reason :: term().

等同於 run_on_node(TestSpecs, false, Node)

連結到此函數

run_on_node(TestSpecs, AllowUserTerms, Node)

檢視原始碼
-spec run_on_node(TestSpecs, AllowUserTerms, Node) -> [{Specs, ok} | {error, Reason}]
                     when
                         TestSpecs :: TestSpec | [TestSpec] | [[TestSpec]],
                         TestSpec :: test_spec(),
                         AllowUserTerms :: boolean(),
                         Node :: node(),
                         Specs :: [file:filename_all()],
                         Reason :: term().

測試會根據 TestSpecsNode 上衍生。

-spec run_test(Node, Opts) -> ok
                  when
                      Node :: node(),
                      Opts :: [OptTuples],
                      OptTuples ::
                          {dir, TestDirs} |
                          {suite, Suites} |
                          {group, Groups} |
                          {testcase, Cases} |
                          {spec, TestSpecs} |
                          {join_specs, boolean()} |
                          {label, Label} |
                          {config, CfgFiles} |
                          {userconfig, UserConfig} |
                          {allow_user_terms, boolean()} |
                          {logdir, LogDir} |
                          {silent_connections, Conns} |
                          {stylesheet, CSSFile} |
                          {cover, CoverSpecFile} |
                          {cover_stop, boolean()} |
                          {step, StepOpts} |
                          {event_handler, EventHandlers} |
                          {include, InclDirs} |
                          {auto_compile, boolean()} |
                          {abort_if_missing_suites, boolean()} |
                          {create_priv_dir, CreatePrivDir} |
                          {multiply_timetraps, M} |
                          {scale_timetraps, boolean()} |
                          {repeat, N} |
                          {duration, DurTime} |
                          {until, StopTime} |
                          {force_stop, ForceStop} |
                          {decrypt, DecryptKeyOrFile} |
                          {refresh_logs, LogDir} |
                          {logopts, LogOpts} |
                          {verbosity, VLevels} |
                          {basic_html, boolean()} |
                          {esc_chars, boolean()} |
                          {keep_logs, KeepSpec} |
                          {ct_hooks, CTHs} |
                          {ct_hooks_order, CTHsOrder} |
                          {enable_builtin_hooks, boolean()} |
                          {release_shell, boolean()},
                      TestDirs :: [string()] | string(),
                      Suites :: [string()] | [atom()] | string() | atom(),
                      Cases :: [atom()] | atom(),
                      Groups :: GroupNameOrPath | [GroupNameOrPath],
                      GroupNameOrPath :: [atom()] | atom() | all,
                      TestSpecs :: [string()] | string(),
                      Label :: string() | atom(),
                      CfgFiles :: [string()] | string(),
                      UserConfig :: [{CallbackMod, CfgStrings}] | {CallbackMod, CfgStrings},
                      CallbackMod :: atom(),
                      CfgStrings :: [string()] | string(),
                      LogDir :: string(),
                      Conns :: all | [atom()],
                      CSSFile :: string(),
                      CoverSpecFile :: string(),
                      StepOpts :: [StepOpt],
                      StepOpt :: config | keep_inactive,
                      EventHandlers :: EH | [EH],
                      EH :: atom() | {atom(), InitArgs} | {[atom()], InitArgs},
                      InitArgs :: [term()],
                      InclDirs :: [string()] | string(),
                      CreatePrivDir :: auto_per_run | auto_per_tc | manual_per_tc,
                      M :: integer(),
                      N :: integer(),
                      DurTime :: HHMMSS,
                      HHMMSS :: string(),
                      StopTime :: YYMoMoDDHHMMSS | HHMMSS,
                      YYMoMoDDHHMMSS :: string(),
                      ForceStop :: skip_rest | boolean(),
                      DecryptKeyOrFile :: {key, DecryptKey} | {file, DecryptFile},
                      DecryptKey :: string(),
                      DecryptFile :: string(),
                      LogOpts :: [LogOpt],
                      LogOpt :: no_nl | no_src,
                      VLevels :: VLevel | [{Category, VLevel}],
                      VLevel :: integer(),
                      Category :: atom(),
                      KeepSpec :: all | pos_integer(),
                      CTHs :: [CTHModule | {CTHModule, CTHInitArgs}],
                      CTHsOrder :: atom(),
                      CTHModule :: atom(),
                      CTHInitArgs :: term().

使用 ct:run_test/1Node 上衍生測試。