Skip to content

Commit

Permalink
log the compiler we found
Browse files Browse the repository at this point in the history
  • Loading branch information
inorton committed Jun 12, 2014
1 parent 4011c4c commit 28daf83
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 516 deletions.
28 changes: 28 additions & 0 deletions CClash.Tests/CompilerCacheTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,34 @@ public void RunEnabledDirectPdb(int times)

}

[Test]
public void TestHashKeyDerive()
{
List<string> compilers = new List<string>
{
@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe",
@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\cl.exe",
@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\cl.exe",
};
var src = @"test-sources\hello.c";

var res = new List<DataHash>();

foreach (var comp in compilers)
{
ICompiler c;
using (var cache = CompilerCacheFactory.Get(true, Settings.CacheDirectory, comp, Environment.CurrentDirectory, Compiler.GetEnvironmentDictionary(), out c))
{
Assert.IsNotNull(c);
Assert.IsTrue(c.ProcessArguments(new string[] { "/nologo", "/c", src }));
Assert.IsNotNull(cache);
var hash = cache.DeriveHashKey(c, c.CompileArgs);
Assert.IsFalse(res.Contains(hash), "expected unique hash key for each compiler");
res.Add(hash);
}
}
}

[Test]
[TestCase(10)]
public void RunEnabledDirect(int times)
Expand Down
12 changes: 11 additions & 1 deletion CClash/CClashServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ public sealed class CClashServer : IDisposable
/// </summary>
public const int MaxServerThreads = 20;

public const int QuitAfterIdleMinutes = 90;
public const int DefaultQuitAfterIdleMinutes = 90;

public int QuitAfterIdleMinutes
{
get
{
var rv = Settings.ServerQuitAfterIdleMinutes;
if (rv == 0) rv = DefaultQuitAfterIdleMinutes;
return rv;
}
}

List<NamedPipeServerStream> serverPipes = new List<NamedPipeServerStream>();
List<Thread> serverThreads = new List<Thread>();
Expand Down
7 changes: 7 additions & 0 deletions CClash/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ static void cygwinEnvFixup()
}

public static string Find()
{
var compiler = _Find();
Logging.Emit("chose compiler {}", compiler);
return compiler;
}

static string _Find()
{
var compiler = Environment.GetEnvironmentVariable("CCLASH_CL");
if ((compiler != null) && File.Exists(compiler)) return compiler;
Expand Down
2 changes: 2 additions & 0 deletions CClash/CompilerCacheBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ public virtual DataHash DigestBinaryFile(string path)

public virtual DataHash DigestCompiler(string compilerPath)
{

return DigestBinaryFile(compilerPath);
}

public DataHash DeriveHashKey( ICompiler comp, IEnumerable<string> args)
{
Logging.Emit("compiler is {0}", comp.CompilerExe);
var comphash = DigestCompiler(comp.CompilerExe);
if (comphash.Result == DataHashResult.Ok)
{
Expand Down
6 changes: 0 additions & 6 deletions CClash/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ public static int Main(string[] args)
Settings.DebugEnabled = true;
}

var miss = Environment.GetEnvironmentVariable("CCLASH_MISSES");
if (!string.IsNullOrEmpty(miss))
{
Settings.MissLogFile = miss;
}

if (Settings.DebugEnabled)
{
Logging.Emit("command line args:");
Expand Down
24 changes: 23 additions & 1 deletion CClash/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ public sealed class Settings
public static bool DebugEnabled { get; set; }
public static string DebugFile { get; set; }

public static string MissLogFile { get; set; }
public static string MissLogFile {
get
{
return Environment.GetEnvironmentVariable("CCLASH_MISSES");
}
}
public static bool MissLogEnabled {
get
{
Expand Down Expand Up @@ -179,5 +184,22 @@ public static bool NoAutoRebuild
return Environment.GetEnvironmentVariable("CCLASH_AUTOREBUILD") == "no";
}
}



public static int ServerQuitAfterIdleMinutes
{
get
{
int rv = 0;
var env = Environment.GetEnvironmentVariable("CCLASH_EXIT_IDLETIME");
if (env != null)
{
Int32.TryParse(env, out rv);
if (rv < 0) rv = 0;
}
return (int)rv;
}
}
}
}
Binary file not shown.
Binary file not shown.

This file was deleted.

251 changes: 0 additions & 251 deletions Installer/Installer/Express/DVD-5/Reports/5-23-2014 06-31-12 AM.htm

This file was deleted.

Loading

0 comments on commit 28daf83

Please sign in to comment.