public bool Run() { bool success = true; int count = 0; int successcnt = 0; foreach (string file in Archives) { using (var fs = new FileStream(file, FileMode.Open)) { using (var gz = new GZipStream(fs, CompressionMode.Decompress)) { using (var tarreader = new TarArchiveReader(gz)) { for (; ;) { TarArchiveReader.Header h; try { h = tarreader.ReadHeader(); } catch (TarArchiveReader.EndOfTarException) { break; } if (h.FileType != TarFileType.File || !h.FileName.StartsWith("assets/") || !h.FileName.EndsWith(".lsl")) { continue; } byte[] scriptdata; using (var ms = new MemoryStream()) { tarreader.CopyTo(ms); scriptdata = ms.ToArray(); } ++count; UUID id = UUID.Parse(h.FileName.Substring(7, 36)); var tr = new TestRunner.TestResult { Name = "Script " + id + "(" + file + ")", Result = false, Message = string.Empty }; int startTime = Environment.TickCount; m_Log.InfoFormat("Testing compilation of {0} ({1})", id, file); try { using (TextReader reader = new StreamReader(new MemoryStream(scriptdata), new UTF8Encoding(false))) { CompilerRegistry.ScriptCompilers.Compile(AppDomain.CurrentDomain, UGUI.Unknown, id, reader, includeOpen: (name) => OpenFile(name)); } m_Log.InfoFormat("Compilation of {0} ({1}) successful", id, file); ++successcnt; tr.Result = true; } catch (CompilerException e) { m_Log.ErrorFormat("Compilation of {0} ({1}) failed: {2}", id, file, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } catch (Exception e) { m_Log.ErrorFormat("Compilation of {0} ({1}) failed: {2}", id, file, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } if (!tr.Result && Directory.Exists("../data/dumps/scripts")) { using (var dumpfs = new FileStream("../data/dumps/scripts/" + id + "_script.lsl", FileMode.Create)) { dumpfs.Write(scriptdata, 0, scriptdata.Length); } } tr.RunTime = Environment.TickCount - startTime; m_Runner.TestResults.Add(tr); } } } } } m_Log.InfoFormat("{0} of {1} compilations successful", successcnt, count); return(success); }