@@ -93,15 +93,15 @@ private static Process executeCommandProcess(String command) throws IOException
93
93
}
94
94
95
95
public static Process rabbitmqctl (String command ) throws IOException {
96
- return executeCommand ("../rabbitmq-server/scripts/rabbitmqctl " + command );
96
+ return executeCommand (rabbitmqctlCommand () + " " + command );
97
97
}
98
98
99
99
public static Process rabbitmqctlIgnoreErrors (String command ) throws IOException {
100
- return executeCommandIgnoringErrors ("../rabbitmq-server/scripts/rabbitmqctl " + command );
100
+ return executeCommandIgnoringErrors (rabbitmqctlCommand () + " " + command );
101
101
}
102
102
103
103
public static Process invokeMakeTarget (String command ) throws IOException {
104
- return executeCommand ("cd ../rabbitmq-test ; " + makeCommand () + " " + command );
104
+ return executeCommand ("cd " + rabbitmqTestDir () + " ; " + makeCommand () + " " + command );
105
105
}
106
106
107
107
private static String makeCommand ()
@@ -118,6 +118,32 @@ private static String makeCommand()
118
118
return makecmd ;
119
119
}
120
120
121
+ private static String rabbitmqctlCommand ()
122
+ {
123
+ // Get the rabbitmqctl(1) executable to use from the environment.
124
+ String cmd = System .getenv ("RABBITMQCTL" );
125
+
126
+ // Default to "make" if the environment variable is unset.
127
+ if (cmd == null ) {
128
+ cmd = "../rabbitmq-server/scripts/rabbitmqctl" ;
129
+ }
130
+
131
+ return cmd ;
132
+ }
133
+
134
+ private static String rabbitmqTestDir ()
135
+ {
136
+ // Get the rabbitmq-test directory to use from the environment.
137
+ String dir = System .getenv ("RABBITMQ_TEST_DIR" );
138
+
139
+ // Default to "make" if the environment variable is unset.
140
+ if (dir == null ) {
141
+ dir = "../rabbitmq-test" ;
142
+ }
143
+
144
+ return dir ;
145
+ }
146
+
121
147
public static void closeConnection (String pid ) throws IOException {
122
148
rabbitmqctl ("close_connection '" + pid + "' 'Closed via rabbitmqctl'" );
123
149
}
0 commit comments