| 1358 | } |
| 1359 | |
| 1360 | static int Remote(string queue, string fdbRoot, double addHours, int testCount, string testTypes, string userScope) |
| 1361 | { |
| 1362 | queue = Path.GetFullPath(queue); |
| 1363 | fdbRoot = Path.GetFullPath(fdbRoot); |
| 1364 | var output = Path.Combine(queue, "archive"); |
| 1365 | var now = DateTime.Now; |
| 1366 | string date = string.Format("{0}-{1:00}-{2:00}-{3:00}-{4:00}", |
| 1367 | now.Year, now.Month, now.Day, now.Hour, now.Minute); |
| 1368 | |
| 1369 | if (!Directory.Exists(queue)) |
| 1370 | Directory.CreateDirectory(queue); |
| 1371 | |
| 1372 | int maxCount = 0; |
| 1373 | foreach (var f in Directory.GetFiles(queue, String.Format("{0}-*.xml", date))) |
| 1374 | { |
| 1375 | var count = Int32.Parse(f.Split('-')[5]); |
| 1376 | maxCount = Math.Max(maxCount, count); |
| 1377 | } |
| 1378 | maxCount++; |
| 1379 | |
| 1380 | var suffix = String.Format("{0}-{1}-{2}", Environment.UserName, userScope, OS_NAME); |
| 1381 | foreach (var f in Directory.GetFiles(queue, "*" + suffix + ".xml")) |
| 1382 | File.Delete(f); |
| 1383 | |
| 1384 | string label = String.Format("{0}-{1}-{2}", date, maxCount, suffix); |
| 1385 | |
| 1386 | var testStaging = Path.Combine(output, label); |
| 1387 | Directory.CreateDirectory(testStaging); |
| 1388 | File.Create(Path.Combine(testStaging, "errors.txt")); |
| 1389 | |
| 1390 | var release = Path.Combine(fdbRoot, "bin"); |
| 1391 | if(!IsRunningOnMono()) |
| 1392 | release = Path.Combine(release, "Release"); |
| 1393 | |
| 1394 | File.Copy(Path.Combine(release, BINARY), Path.Combine(testStaging, BINARY)); |
| 1395 | File.Copy(Path.Combine(fdbRoot, "tls-plugins", PLUGIN), Path.Combine(testStaging, PLUGIN)); |
| 1396 | |
| 1397 | if (IsRunningOnMono()) |
| 1398 | File.Copy(Path.Combine(release, BINARY + ".debug"), Path.Combine(testStaging, BINARY + ".debug")); |
| 1399 | |
| 1400 | //using (var f = System.IO.File.Open( |
| 1401 | // Path.Combine(testStaging, "summary.xml"), |
| 1402 | // System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite, System.IO.FileShare.Delete)) |
| 1403 | //{ |
| 1404 | // byte[] bytes = Encoding.UTF8.GetBytes("<Trace>"); |
| 1405 | // f.Write(bytes, 0, bytes.Length); |
| 1406 | //} |
| 1407 | |
| 1408 | var coverageFiles = Directory.GetFiles(release, "coverage*.xml"); |
| 1409 | foreach (var coverage in coverageFiles) |
| 1410 | File.Copy(coverage, Path.Combine(testStaging, Path.GetFileName(coverage))); |
| 1411 | |
| 1412 | Directory.CreateDirectory(Path.Combine(testStaging, "tests")); |
| 1413 | |
| 1414 | if (testTypes == "fast" || testTypes == "all") |
| 1415 | CopyAll(new DirectoryInfo(Path.Combine(fdbRoot, "tests", "fast")), new DirectoryInfo(Path.Combine(testStaging, "tests", "fast"))); |
| 1416 | if (testTypes == "restarting" || testTypes == "all") |
| 1417 | { |