//[TestCase(5, 5, true, true)] // TODO - pdb support is patchy, suppression is only for openssl public void RunEnabledDirectServerFolders(int times, int filecount, bool debug, bool pdb) { Assert.IsFalse(Settings.Disabled); Assert.IsTrue(Settings.DirectMode); var comp = CompilerTest.CompilerPath; Environment.SetEnvironmentVariable("CCLASH_SERVER", "1"); Environment.SetEnvironmentVariable("CCLASH_Z7_OBJ", "yes"); Environment.SetEnvironmentVariable("PATH", System.IO.Path.GetDirectoryName(comp) + ";" + Environment.GetEnvironmentVariable("PATH")); var server = new Thread(() => { Program.Main(new string[] { "--cclash-server", "--debug" }); }); server.Start(); try { while (Program.Server == null || !Program.Server.FirstThreadReady) { Thread.Sleep(100); } Console.Error.WriteLine("server ready"); var files = MakeLotsOfFiles(filecount); for (int i = 0; i < times; i++) { foreach (var fn in files) { var dir = System.IO.Path.GetDirectoryName(fn); var file = System.IO.Path.GetFileName(fn); var obj = System.IO.Path.GetFileNameWithoutExtension(file) + ".obj"; var pdbfile = System.IO.Path.GetFileNameWithoutExtension(file) + ".pdb"; Environment.CurrentDirectory = dir; var compargs = new List <string> { "/nologo", "/Wall", "/c", file }; if (debug) { if (pdb) { compargs.Add("/Zi"); compargs.Add("/Fd" + pdbfile); } else { compargs.Add("/Z7"); } } var rv = Program.Main(compargs.ToArray()); Assert.IsTrue(FileUtils.Exists(obj)); if (pdb) { // CCLASH_Z7_OBJ should suppress the pdb Assert.IsFalse(FileUtils.Exists(pdbfile)); } Assert.AreEqual(0, rv); } } } finally { Program.Main(new string[] { "--cclash", "--stop" }); server.Join(); } }