Skip to content

Commit f49dda1

Browse files
committed
Revert "Add code to trace execusion of test TestPlugins.testProcess() which hangs on AppVeyor."
This reverts commit 6375f36.
1 parent 3872670 commit f49dda1

File tree

1 file changed

+2
-69
lines changed

1 file changed

+2
-69
lines changed

src/tests/TestPlugins.cpp

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@
3636
#include "rapidassist/timing.h"
3737
#include "rapidassist/process.h"
3838

39-
#include "Environment.h"
40-
#include "rapidassist/environment_utf8.h"
41-
4239
namespace shellanything
4340
{
4441
namespace test
4542
{
46-
//extern void KillCalculatorProcess();
47-
//extern bool StartCalculatorProcess(ra::process::processid_t& pId);
43+
extern void KillCalculatorProcess();
44+
extern bool StartCalculatorProcess(ra::process::processid_t& pId);
4845
extern void KillMsPaintProcess();
4946
extern bool StartMsPaintProcess(ra::process::processid_t& pId);
5047

@@ -104,70 +101,40 @@ namespace shellanything
104101
//--------------------------------------------------------------------------------------------------
105102
TEST_F(TestPlugins, testProcess)
106103
{
107-
#define TRACE_LINE printf("%s, line %d\n", __FUNCTION__, __LINE__)
108-
109-
TRACE_LINE;
110-
111-
{
112-
// Force verbose mode
113-
static const std::string& VERBOSE_OPTION_NAME = Environment::SYSTEM_LOGGING_VERBOSE_ENVIRONMENT_VARIABLE_NAME;
114-
ra::environment::SetEnvironmentVariableUtf8(VERBOSE_OPTION_NAME.c_str(), "true");
115-
116-
117-
}
118-
119-
TRACE_LINE;
120-
121104
ConfigManager& cmgr = ConfigManager::GetInstance();
122105

123-
TRACE_LINE;
124-
125106
//Creating a temporary workspace for the test execution.
126107
Workspace workspace;
127108
ASSERT_FALSE(workspace.GetBaseDirectory().empty());
128109
ASSERT_TRUE(workspace.IsEmpty());
129110

130-
TRACE_LINE;
131-
132111
//Import the required files into the workspace
133112
static const std::string path_separator = ra::filesystem::GetPathSeparatorStr();
134113
std::string test_name = ra::testing::GetTestQualifiedName();
135114
std::string template_source_path = std::string("test_files") + path_separator + test_name + ".xml";
136115
ASSERT_TRUE(workspace.ImportFileUtf8(template_source_path.c_str()));
137116

138-
TRACE_LINE;
139-
140117
//Wait to make sure that the next file copy/modification will not have the same timestamp
141118
ra::timing::Millisleep(1500);
142119

143-
TRACE_LINE;
144-
145120
//Setup ConfigManager to read files from workspace
146121
cmgr.ClearSearchPath();
147122
cmgr.AddSearchPath(workspace.GetBaseDirectory());
148123
cmgr.Refresh();
149124

150-
TRACE_LINE;
151-
152125
//ASSERT the file is loaded
153126
ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles();
154127
ASSERT_EQ(1, configs.size());
155128

156-
TRACE_LINE;
157-
158129
ConfigFile* config0 = cmgr.GetConfigFiles()[0];
159130

160-
TRACE_LINE;
161-
162131
//ASSERT all plugins were loaded
163132
for (size_t i = 0; i < config0->GetPlugins().size(); i++)
164133
{
165134
const Plugin* plugin = config0->GetPlugins()[i];
166135
ASSERT_TRUE(plugin->IsLoaded()) << "The plugin '" << plugin->GetPath() << "' is not loaded.";
167136
}
168137

169-
TRACE_LINE;
170-
171138
//Get menus
172139
Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus();
173140
ASSERT_EQ(4, menus.size());
@@ -180,8 +147,6 @@ namespace shellanything
180147
ASSERT_TRUE(menu2 != NULL);
181148
ASSERT_TRUE(menu3 != NULL);
182149

183-
TRACE_LINE;
184-
185150
//ASSERT all expected content is parsed
186151
for (size_t i = 0; i < menus.size(); i++)
187152
{
@@ -196,31 +161,21 @@ namespace shellanything
196161
ASSERT_EQ(1, actions.size());
197162
}
198163

199-
TRACE_LINE;
200-
201164
PropertyManager& pmgr = PropertyManager::GetInstance();
202165

203-
TRACE_LINE;
204-
205166
//Disable process id property
206167
pmgr.SetProperty("sa_plugin_process.pid", "");
207168

208-
TRACE_LINE;
209-
210169
//Kill all instances of mspaint.exe
211170
KillMsPaintProcess();
212171

213-
TRACE_LINE;
214-
215172
//Set all menus visible
216173
for (size_t i = 0; i < menus.size(); i++)
217174
{
218175
Menu* menu = menus[i];
219176
menu->SetVisible(true);
220177
}
221178

222-
TRACE_LINE;
223-
224179
//Force an update to call the plugin
225180
SelectionContext c;
226181
#ifdef _WIN32
@@ -234,78 +189,56 @@ namespace shellanything
234189
#endif
235190
config0->Update(c);
236191

237-
TRACE_LINE;
238-
239192
//ASSERT all menus are now invisible
240193
for (size_t i = 0; i < menus.size(); i++)
241194
{
242195
Menu* menu = menus[i];
243196
ASSERT_FALSE(menu->IsVisible()) << "menu[" << i << "] named '" << menu->GetName() << "' should be invisible";
244197
}
245198

246-
TRACE_LINE;
247-
248199
//Start mspaint
249200
ra::process::processid_t pId = 0;
250201
ASSERT_TRUE( StartMsPaintProcess(pId) );
251202

252-
TRACE_LINE;
253-
254203
//Set all menus visible
255204
for (size_t i = 0; i < menus.size(); i++)
256205
{
257206
Menu* menu = menus[i];
258207
menu->SetVisible(true);
259208
}
260209

261-
TRACE_LINE;
262-
263210
//Update menus again
264211
config0->Update(c);
265212

266-
TRACE_LINE;
267-
268213
//ASSERT that half of menus are now invisible
269214
ASSERT_TRUE(menu0->IsVisible()) << "Menu named '" << menu0->GetName() << "' should be visible";
270215
ASSERT_FALSE(menu1->IsVisible()) << "Menu named '" << menu1->GetName() << "' should be invisible";
271216
ASSERT_TRUE(menu2->IsVisible()) << "Menu named '" << menu2->GetName() << "' should be visible";
272217
ASSERT_FALSE(menu3->IsVisible()) << "Menu named '" << menu3->GetName() << "' should be invisible";
273218

274-
TRACE_LINE;
275-
276219
//Set all menus invisible
277220
for (size_t i = 0; i < menus.size(); i++)
278221
{
279222
Menu* menu = menus[i];
280223
menu->SetVisible(false);
281224
}
282225

283-
TRACE_LINE;
284-
285226
// Change a property which is used by menus to filter visibility by pid
286227
pmgr.SetProperty("sa_plugin_process.pid", ra::strings::ToString(pId));
287228

288-
TRACE_LINE;
289-
290229
//Update menus again
291230
config0->Update(c);
292231

293-
TRACE_LINE;
294-
295232
//ASSERT all menus are now visible
296233
for (size_t i = 0; i < menus.size(); i++)
297234
{
298235
Menu* menu = menus[i];
299236
ASSERT_TRUE(menu->IsVisible()) << "menu[" << i << "] named '" << menu->GetName() << "' should be visible";
300237
}
301238

302-
TRACE_LINE;
303-
304239
//Cleanup
305240
KillMsPaintProcess();
306241
ASSERT_TRUE(workspace.Cleanup()) << "Failed deleting workspace directory '" << workspace.GetBaseDirectory() << "'.";
307-
308-
TRACE_LINE;
309242
}
310243
//--------------------------------------------------------------------------------------------------
311244
TEST_F(TestPlugins, testServices)

0 commit comments

Comments
 (0)