File 0601-ct-Add-missing-types.patch of Package erlang
From d23e05caec60dcad0596122204db1c838518e71e Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Mon, 9 Oct 2023 15:29:57 +0200
Subject: [PATCH 01/13] ct: Add missing types
---
lib/common_test/src/ct_ftp.erl | 4 ++++
lib/common_test/src/ct_snmp.erl | 33 +++++++++++++++++++++++++++++++
lib/common_test/src/ct_ssh.erl | 8 ++++++++
lib/common_test/src/ct_telnet.erl | 6 ++++++
4 files changed, 51 insertions(+)
diff --git a/lib/common_test/src/ct_ftp.erl b/lib/common_test/src/ct_ftp.erl
index 0867e75d9e..ceb73254ea 100644
--- a/lib/common_test/src/ct_ftp.erl
+++ b/lib/common_test/src/ct_ftp.erl
@@ -33,6 +33,10 @@
-define(DEFAULT_PORT,21).
+-type connection() :: handle() | ct:target_name().
+-type handle() :: ct:handle().
+-export_type([connection/0, handle/0]).
+
%%%=================================================================
%%% API
diff --git a/lib/common_test/src/ct_snmp.erl b/lib/common_test/src/ct_snmp.erl
index 1e9333f656..78b3707754 100644
--- a/lib/common_test/src/ct_snmp.erl
+++ b/lib/common_test/src/ct_snmp.erl
@@ -31,6 +31,39 @@
unregister_agents/2, unregister_usm_users/1, unregister_usm_users/2,
load_mibs/1, unload_mibs/1]).
+-type agent_config() :: {Item :: term(), Value :: term()}.
+-type agent_ip() :: ip().
+-type agent_name() :: atom().
+-type agent_port() :: integer().
+-type call_back_module() :: atom().
+-type error_index() :: integer().
+-type error_status() :: noError | atom().
+-type ip() :: string() | {integer(), integer(), integer(), integer()}.
+-type manager_ip() :: ip().
+-type oid() :: [byte()].
+-type oids() :: [oid()].
+-type rel_path() :: string().
+-type sec_type() :: none | minimum | semi.
+-type snmp_app_agent_params() :: term().
+-type snmp_app_manager_params() :: term().
+-type snmpreply() :: {error_status(), error_index(), varbinds()}.
+-type user_data() :: term().
+-type user_name() :: atom().
+-type usm_config() :: {Item :: term(), Value :: term()}.
+-type usm_user_name() :: string().
+-type value_type() :: o | i | u | g | s.
+-type var_and_val() :: {oid(), value_type(), term()}.
+-type varbind() :: term().
+-type varbinds() :: [varbind()].
+-type varsandvals() :: [var_and_val()].
+
+-export_type([agent_config/0, agent_ip/0, agent_name/0, agent_port/0,
+ call_back_module/0, error_index/0, error_status/0, ip/0,
+ manager_ip/0, oid/0, oids/0, rel_path/0, sec_type/0,
+ snmp_app_agent_params/0, snmp_app_manager_params/0, snmpreply/0,
+ user_data/0, user_name/0, usm_config/0, usm_user_name/0,
+ value_type/0, var_and_val/0, varbind/0, varbinds/0, varsandvals/0]).
+
%% Manager values
-define(CT_SNMP_LOG_FILE, "ct_snmp_set.log").
-define(MGR_PORT, 5000).
diff --git a/lib/common_test/src/ct_ssh.erl b/lib/common_test/src/ct_ssh.erl
index 1475b7bfd6..87ed1da5a2 100644
--- a/lib/common_test/src/ct_ssh.erl
+++ b/lib/common_test/src/ct_ssh.erl
@@ -58,6 +58,8 @@
-record(state, {ssh_ref, conn_type, target}).
-type handle() :: pid().
+-type ssh_sftp_return() :: term().
+-type connection() :: handle() | ct:target_name().
%%%-----------------------------------------------------------------
%%%------------------------ SSH COMMANDS ---------------------------
@@ -311,6 +313,12 @@ aread(SSH, Handle, Len) ->
aread(SSH, Server, Handle, Len) ->
call(SSH, {aread,Server,Handle,Len}).
+-spec apread(SSH, Handle, Position, Length) -> Result when
+ SSH :: connection(),
+ Handle :: term(),
+ Position :: integer(),
+ Length :: integer(),
+ Result :: ssh_sftp_return().
apread(SSH, Handle, Position, Length) ->
call(SSH, {apread,sftp,Handle,Position,Length}).
diff --git a/lib/common_test/src/ct_telnet.erl b/lib/common_test/src/ct_telnet.erl
index e06b6a5ef2..f7a5d3e530 100644
--- a/lib/common_test/src/ct_telnet.erl
+++ b/lib/common_test/src/ct_telnet.erl
@@ -42,6 +42,12 @@
-include("ct_util.hrl").
+-type connection() :: handle() | {ct:target_name(), connection_type()} | ct:target_name().
+-type connection_type() :: telnet | ts1 | ts2.
+-type handle() :: ct:handle().
+-type prompt_regexp() :: string().
+-export_type([connection/0, connection_type/0, handle/0, prompt_regexp/0]).
+
-record(state,{host,
port,
teln_pid,
--
2.35.3