1
2#
3# This include will remove a debug point from the current GLOBAL or SESSION
4# debug variable without changing other debugging flags set.
5#
6# ==== Usage ====
7#
8# --let $debug_point= debug_point
9# [--let $debug_point_silent= 1]
10# [--let $debug_type= GLOBAL | SESSION]
11# --source extra/rpl_tests/remove_debug_point.inc
12#
13# Parameters:
14#   $debug_point
15#     The debug point to be activated.
16#
17#   $debug_point_silent
18#     By default, this script prints the name of the debug point. If
19#     this parameter is set, it does not print anything.
20#
21#   $debug_type
22#     If the debug variable to be changed is the GLOBAL or SESSION one.
23#     The default (if not specified one) is GLOBAL.
24#
25
26--let $_previous_include_silent= $include_silent
27--let $include_silent= 1
28--let $include_filename= remove_debug_point.inc
29--source include/begin_include_file.inc
30--let $include_silent= $_previous_include_silent
31
32if (!$debug_type)
33{
34  --let $_debug_type= GLOBAL
35}
36if ($debug_type)
37{
38  --let $_debug_type= $debug_type
39}
40if ( `SELECT UPPER('$_debug_type') <> 'GLOBAL' AND UPPER('$_debug_type') <> 'SESSION'` )
41{
42  --die ERROR IN TEST: invalid value for mysqltest variable 'debug_type': $debug_type
43}
44if (!$debug_point)
45{
46  --die ERROR IN TEST: the mysqltest variable 'debug_point' must be set
47}
48
49--disable_query_log
50
51--eval SET @previous_debug=@@$_debug_type.debug
52--eval SET @new_debug=@@$_debug_type.debug
53
54if (`SELECT LOCATE('$debug_point', @previous_debug) > 0`)
55{
56  --eval SET @new_debug=REPLACE(@previous_debug, ',$debug_point', '')
57
58  # If there is no other debug options, we will clean it up
59  if (`SELECT @new_debug="d"`)
60  {
61    SET @new_debug="";
62  }
63}
64
65if (`SELECT @new_debug = @previous_debug`)
66{
67  --die ERROR IN TEST: the debug point '$debug_point' was not found
68}
69
70if (!$debug_point_silent)
71{
72  --let $message_prefix=`SELECT REPEAT("#", $_include_file_depth)`
73  --echo $message_prefix Removing debug point '$debug_point' from @@$_debug_type.debug
74}
75
76if ($rpl_debug)
77{
78  --let $_to_display=`SELECT @@$_debug_type.debug`
79  --echo @@$_debug_type.debug was '$_to_display'
80}
81
82--eval SET @@$_debug_type.debug=@new_debug
83
84if ($rpl_debug)
85{
86  --let $_to_display=`SELECT @@$_debug_type.debug`
87  --echo @@$_debug_type.debug set to '$_to_display'
88}
89
90--let $include_filename= remove_debug_point.inc
91--source include/end_include_file.inc
92