You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
@@ -47,18 +47,19 @@ net_4_5_dirs := \
|
||||
mdb2ppdb \
|
||||
ikdasm \
|
||||
mono-symbolicate \
|
||||
linker-analyzer
|
||||
linker-analyzer \
|
||||
gacutil
|
||||
|
||||
build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker cil-strip corcompare mono-api-diff mono-api-html
|
||||
monodroid_tools_SUBDIRS = cil-strip linker-analyzer mkbundle mdoc mono-symbolicate
|
||||
build_SUBDIRS =
|
||||
build_PARALLEL_SUBDIRS := resgen gacutil security culevel commoncryptogenerator resx2sr linker cil-strip corcompare mono-api-diff mono-api-html
|
||||
monodroid_tools_SUBDIRS =
|
||||
monodroid_tools_PARALLEL_SUBDIRS = cil-strip linker-analyzer mkbundle mdoc mono-symbolicate
|
||||
monodroid_SUBDIRS = nunit-lite
|
||||
monotouch_SUBDIRS = nunit-lite
|
||||
net_4_5_SUBDIRS = gacutil
|
||||
net_4_x_SUBDIRS = gacutil
|
||||
net_4_5_PARALLEL_SUBDIRS = $(net_4_5_dirs)
|
||||
net_4_x_SUBDIRS =
|
||||
net_4_x_PARALLEL_SUBDIRS = $(net_4_5_dirs)
|
||||
|
||||
SUBDIRS = $(build_SUBDIRS) $(net_4_5_dirs)
|
||||
DIST_SUBDIRS = $(net_4_5_dirs) cil-stringreplacer commoncryptogenerator resx2sr
|
||||
|
||||
include ../build/rules.make
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using Mono.Cecil;
|
||||
@@ -15,25 +16,32 @@ using Mono.Cecil;
|
||||
namespace Mono.CilStripper {
|
||||
|
||||
class Program {
|
||||
|
||||
static int Main (string [] args)
|
||||
static bool quiet;
|
||||
static int Main (string [] arguments)
|
||||
{
|
||||
var args = new List<string> (arguments);
|
||||
if (args.Count > 0 && args [0] == "-q") {
|
||||
quiet = true;
|
||||
args.RemoveAt (0);
|
||||
}
|
||||
Header ();
|
||||
|
||||
if (args.Length == 0)
|
||||
if (args.Count == 0)
|
||||
Usage ();
|
||||
|
||||
string file = args [0];
|
||||
string output = args.Length > 1 ? args [1] : file;
|
||||
string output = args.Count > 1 ? args [1] : file;
|
||||
|
||||
try {
|
||||
AssemblyDefinition assembly = AssemblyFactory.GetAssembly (file);
|
||||
StripAssembly (assembly, output);
|
||||
|
||||
if (file != output)
|
||||
Console.WriteLine ("Assembly {0} stripped out into {1}", file, output);
|
||||
else
|
||||
Console.WriteLine ("Assembly {0} stripped", file);
|
||||
if (!quiet) {
|
||||
if (file != output)
|
||||
Console.WriteLine ("Assembly {0} stripped out into {1}", file, output);
|
||||
else
|
||||
Console.WriteLine ("Assembly {0} stripped", file);
|
||||
}
|
||||
return 0;
|
||||
} catch (TargetInvocationException tie) {
|
||||
Console.WriteLine ("Error: {0}", tie.InnerException);
|
||||
@@ -50,13 +58,16 @@ namespace Mono.CilStripper {
|
||||
|
||||
static void Header ()
|
||||
{
|
||||
if (quiet)
|
||||
return;
|
||||
Console.WriteLine ("Mono CIL Stripper");
|
||||
Console.WriteLine ();
|
||||
}
|
||||
|
||||
static void Usage ()
|
||||
{
|
||||
Console.WriteLine ("Usage: mono-cil-strip file [output]");
|
||||
Console.WriteLine ("Usage: mono-cil-strip [options] file [output]");
|
||||
Console.WriteLine (" -q Only output errors.");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
}
|
||||
|
@@ -423,18 +423,21 @@ namespace TestRunner {
|
||||
class Checker: MarshalByRefObject, IDisposable
|
||||
{
|
||||
protected ITester tester;
|
||||
protected int success;
|
||||
protected int total;
|
||||
protected int ignored;
|
||||
protected int syntax_errors;
|
||||
string issue_file;
|
||||
StreamWriter log_file;
|
||||
StreamWriter result_xml;
|
||||
protected string[] extra_compiler_options;
|
||||
protected string reference_dir;
|
||||
// protected string[] compiler_options;
|
||||
// protected string[] dependencies;
|
||||
|
||||
protected ArrayList tests = new ArrayList ();
|
||||
protected Hashtable test_hash = new Hashtable ();
|
||||
protected Dictionary<string, StringBuilder> file_log_lines = new Dictionary<string, StringBuilder> ();
|
||||
protected ArrayList succeeded = new ArrayList ();
|
||||
protected ArrayList regression = new ArrayList ();
|
||||
protected ArrayList know_issues = new ArrayList ();
|
||||
protected ArrayList ignore_list = new ArrayList ();
|
||||
@@ -464,6 +467,17 @@ namespace TestRunner {
|
||||
}
|
||||
}
|
||||
|
||||
public string ResultXml {
|
||||
set {
|
||||
this.result_xml = new StreamWriter (value, false);
|
||||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool Verbose {
|
||||
set {
|
||||
verbose = value;
|
||||
@@ -482,6 +496,12 @@ namespace TestRunner {
|
||||
}
|
||||
}
|
||||
|
||||
public string ReferenceDirectory {
|
||||
set {
|
||||
reference_dir = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool GetExtraOptions (string file, out string[] compiler_options,
|
||||
out string[] dependencies)
|
||||
{
|
||||
@@ -519,7 +539,7 @@ namespace TestRunner {
|
||||
if (index != -1) {
|
||||
compiler_options = line.Substring (index + options.Length).Trim().Split (' ');
|
||||
for (int i = 0; i < compiler_options.Length; i++)
|
||||
compiler_options[i] = compiler_options[i].TrimStart ();
|
||||
compiler_options[i] = compiler_options[i].TrimStart ().Replace ("$REF_DIR", reference_dir);
|
||||
}
|
||||
index = line.IndexOf (depends);
|
||||
if (index != -1) {
|
||||
@@ -536,6 +556,8 @@ namespace TestRunner {
|
||||
if (test_hash.Contains (filename))
|
||||
return true;
|
||||
|
||||
file_log_lines.Add (filename, new StringBuilder ());
|
||||
|
||||
if (verbose)
|
||||
Log (filename + "...\t");
|
||||
|
||||
@@ -641,8 +663,8 @@ namespace TestRunner {
|
||||
LogLine ("Done" + Environment.NewLine);
|
||||
float rate = 0;
|
||||
if (total > 0)
|
||||
rate = (float) (success) / (float)total;
|
||||
LogLine ("{0} test cases passed ({1:0.##%})", success, rate);
|
||||
rate = (float) (succeeded.Count) / (float)total;
|
||||
LogLine ("{0} test cases passed ({1:0.##%})", succeeded.Count, rate);
|
||||
|
||||
if (syntax_errors > 0)
|
||||
LogLine ("{0} test(s) ignored because of wrong syntax !", syntax_errors);
|
||||
@@ -668,6 +690,72 @@ namespace TestRunner {
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OutputResultXml ()
|
||||
{
|
||||
if (result_xml == null)
|
||||
return;
|
||||
|
||||
var xmlWriter = new XmlTextWriter (result_xml);
|
||||
xmlWriter.Formatting = Formatting.Indented;
|
||||
|
||||
xmlWriter.WriteStartDocument ();
|
||||
|
||||
xmlWriter.WriteStartElement ("assemblies");
|
||||
|
||||
xmlWriter.WriteStartElement ("assembly");
|
||||
|
||||
xmlWriter.WriteAttributeString ("name", Name);
|
||||
xmlWriter.WriteAttributeString ("environment", $"compiler-tester-version: {Assembly.GetExecutingAssembly ().GetName ()}, clr-version: {Environment.Version}, os-version: {Environment.OSVersion}, platform: {Environment.OSVersion.Platform}, cwd: {Environment.CurrentDirectory}, machine-name: {Environment.MachineName}, user: {Environment.UserName}, user-domain: {Environment.UserDomainName}");
|
||||
xmlWriter.WriteAttributeString ("test-framework", "compiler-tester");
|
||||
xmlWriter.WriteAttributeString ("run-date", XmlConvert.ToString (DateTime.Now, "yyyy-MM-dd"));
|
||||
xmlWriter.WriteAttributeString ("run-time", XmlConvert.ToString (DateTime.Now, "HH:mm:ss"));
|
||||
|
||||
xmlWriter.WriteAttributeString ("total", (succeeded.Count + regression.Count).ToString ()); // ignore known issues and ignored tests for now, we care mostly about failures
|
||||
xmlWriter.WriteAttributeString ("errors", 0.ToString ());
|
||||
xmlWriter.WriteAttributeString ("failed", (regression.Count).ToString ());
|
||||
xmlWriter.WriteAttributeString ("skipped", 0.ToString ());
|
||||
|
||||
xmlWriter.WriteAttributeString ("passed", succeeded.Count.ToString ());
|
||||
|
||||
xmlWriter.WriteStartElement ("collection");
|
||||
xmlWriter.WriteAttributeString ("name", "tests");
|
||||
|
||||
foreach (var t in succeeded) {
|
||||
xmlWriter.WriteStartElement ("test");
|
||||
xmlWriter.WriteAttributeString ("name", Name + ".tests." + t);
|
||||
xmlWriter.WriteAttributeString ("type", Name + ".tests");
|
||||
xmlWriter.WriteAttributeString ("method", t.ToString ());
|
||||
xmlWriter.WriteAttributeString ("result", "Pass");
|
||||
xmlWriter.WriteAttributeString ("time", "0");
|
||||
xmlWriter.WriteEndElement (); // test element
|
||||
}
|
||||
|
||||
foreach (var t in regression) {
|
||||
xmlWriter.WriteStartElement ("test");
|
||||
xmlWriter.WriteAttributeString ("name", Name + ".tests." + t);
|
||||
xmlWriter.WriteAttributeString ("type", Name + ".tests");
|
||||
xmlWriter.WriteAttributeString ("method", t.ToString ());
|
||||
xmlWriter.WriteAttributeString ("result", "Fail");
|
||||
xmlWriter.WriteAttributeString ("time", "0");
|
||||
|
||||
xmlWriter.WriteStartElement ("failure");
|
||||
xmlWriter.WriteAttributeString ("exception-type", "CompilerTesterException");
|
||||
xmlWriter.WriteStartElement ("message");
|
||||
xmlWriter.WriteCData (file_log_lines[(string)t].ToString ());
|
||||
xmlWriter.WriteEndElement (); // message element
|
||||
xmlWriter.WriteEndElement(); // failure element
|
||||
|
||||
xmlWriter.WriteEndElement(); // test element
|
||||
}
|
||||
|
||||
xmlWriter.WriteEndElement (); // collection
|
||||
xmlWriter.WriteEndElement (); // assembly
|
||||
xmlWriter.WriteEndElement (); // assemblies
|
||||
xmlWriter.WriteEndDocument ();
|
||||
xmlWriter.Flush ();
|
||||
xmlWriter.Close ();
|
||||
}
|
||||
|
||||
public int ResultCode
|
||||
{
|
||||
get {
|
||||
@@ -696,11 +784,24 @@ namespace TestRunner {
|
||||
log_file.WriteLine (msg, rest);
|
||||
}
|
||||
|
||||
protected void LogLineForFile (string file, string msg)
|
||||
{
|
||||
file_log_lines[file].AppendLine (msg);
|
||||
LogLine (msg);
|
||||
}
|
||||
|
||||
protected void LogLineForFile (string file, string msg, params object [] rest)
|
||||
{
|
||||
file_log_lines[file].AppendLine (String.Format (msg, rest));
|
||||
LogLine (msg, rest);
|
||||
}
|
||||
|
||||
public void LogFileLine (string file, string msg)
|
||||
{
|
||||
string s = verbose ? msg : file + "...\t" + msg;
|
||||
|
||||
Console.WriteLine (s);
|
||||
file_log_lines[file].AppendLine (s);
|
||||
if (log_file != null)
|
||||
log_file.WriteLine (s);
|
||||
}
|
||||
@@ -722,6 +823,7 @@ namespace TestRunner {
|
||||
public virtual void CleanUp ()
|
||||
{
|
||||
PrintSummary ();
|
||||
OutputResultXml ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1138,7 +1240,7 @@ namespace TestRunner {
|
||||
{
|
||||
switch (status) {
|
||||
case TestResult.Success:
|
||||
success++;
|
||||
succeeded.Add (file);
|
||||
if (know_issues.Contains (file)) {
|
||||
LogFileLine (file, "FIXED ISSUE");
|
||||
return;
|
||||
@@ -1196,7 +1298,7 @@ namespace TestRunner {
|
||||
}
|
||||
|
||||
if (extra != null)
|
||||
LogLine ("{0}", extra);
|
||||
LogLineForFile (file, "{0}", extra);
|
||||
|
||||
if (!regression.Contains (file))
|
||||
regression.Add (file);
|
||||
@@ -1377,12 +1479,12 @@ namespace TestRunner {
|
||||
|
||||
CompilerError result_code = GetCompilerError (expected, tester.Output);
|
||||
if (HandleFailure (filename, result_code)) {
|
||||
success++;
|
||||
succeeded.Add (filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (result_code == CompilerError.Wrong)
|
||||
LogLine (tester.Output);
|
||||
LogLineForFile (filename, tester.Output);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1494,8 +1596,8 @@ namespace TestRunner {
|
||||
}
|
||||
else {
|
||||
LogFileLine (file, "REGRESSION (CORRECT ERROR -> WRONG ERROR MESSAGE)");
|
||||
LogLine ("Exp: {0}", expected_message);
|
||||
LogLine ("Was: {0}", error_message);
|
||||
LogLineForFile (file, "Exp: {0}", expected_message);
|
||||
LogLineForFile (file, "Was: {0}", error_message);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1626,10 +1728,14 @@ namespace TestRunner {
|
||||
checker.IssueFile = temp;
|
||||
if (GetOption ("log", args, true, out temp))
|
||||
checker.LogFile = temp;
|
||||
if (GetOption ("resultXml", args, true, out temp))
|
||||
checker.ResultXml = temp;
|
||||
if (GetOption ("verbose", args, false, out temp))
|
||||
checker.Verbose = true;
|
||||
if (GetOption ("safe-execution", args, false, out temp))
|
||||
checker.SafeExecution = true;
|
||||
if (GetOption ("reference-dir", args, true, out temp))
|
||||
checker.ReferenceDirectory = temp;
|
||||
if (GetOption ("compiler-options", args, true, out temp)) {
|
||||
string[] extra = temp.Split (' ');
|
||||
checker.ExtraCompilerOptions = extra;
|
||||
@@ -1641,19 +1747,20 @@ namespace TestRunner {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var files = new List<string> ();
|
||||
var files = new List<FileInfo> ();
|
||||
var test_directory = new DirectoryInfo (".");
|
||||
switch (test_pattern) {
|
||||
case "v1":
|
||||
files.AddRange (Directory.GetFiles (".", positive ? "test*.cs" : "cs*.cs"));
|
||||
files.AddRange (test_directory.EnumerateFiles (positive ? "test*.cs" : "cs*.cs"));
|
||||
break;
|
||||
case "v2":
|
||||
files.AddRange (Directory.GetFiles (".", positive ? "gtest*.cs" : "gcs*.cs"));
|
||||
files.AddRange (test_directory.EnumerateFiles (positive ? "gtest*.cs" : "gcs*.cs"));
|
||||
goto case "v1";
|
||||
case "v4":
|
||||
files.AddRange (Directory.GetFiles (".", positive ? "dtest*.cs" : "dcs*.cs"));
|
||||
files.AddRange (test_directory.EnumerateFiles (positive ? "dtest*.cs" : "dcs*.cs"));
|
||||
goto case "v2";
|
||||
default:
|
||||
files.AddRange (Directory.GetFiles (".", test_pattern));
|
||||
files.AddRange (test_directory.EnumerateFiles (test_pattern));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1662,6 +1769,7 @@ namespace TestRunner {
|
||||
return 2;
|
||||
}
|
||||
|
||||
checker.Name = test_directory.Name;
|
||||
checker.Initialize ();
|
||||
/*
|
||||
files.Sort ((a, b) => {
|
||||
@@ -1676,8 +1784,8 @@ namespace TestRunner {
|
||||
return a.CompareTo (b);
|
||||
});
|
||||
*/
|
||||
foreach (string s in files) {
|
||||
string filename = Path.GetFileName (s);
|
||||
foreach (FileInfo s in files) {
|
||||
string filename = s.Name;
|
||||
if (Char.IsUpper (filename, 0)) { // Windows hack
|
||||
continue;
|
||||
}
|
||||
@@ -1727,9 +1835,11 @@ namespace TestRunner {
|
||||
" \n" +
|
||||
" -compiler:FILE The file which will be used to compiler tests\n" +
|
||||
" -compiler-options:OPTIONS Add global compiler options\n" +
|
||||
" -reference-dir:DIRECTORY Use this directory for $REF_DIR variable in tests\n" +
|
||||
" -il:IL-FILE XML file with expected IL details for each test\n" +
|
||||
" -issues:FILE The list of expected failures\n" +
|
||||
" -log:FILE Writes any output also to the file\n" +
|
||||
" -resultXml:FILE Writes test result data in xUnit.net v2 format to the file\n" +
|
||||
" -help Lists all options\n" +
|
||||
" -mode:[pos|neg] Specifies compiler test mode\n" +
|
||||
" -safe-execution Runs compiled executables in separate app-domain\n" +
|
||||
|
@@ -11,16 +11,17 @@ TEST_CASES := \
|
||||
mscorlib/test-exception-01.cs \
|
||||
mscorlib/test-locale-01.cs \
|
||||
mscorlib/test-reflection-01.cs \
|
||||
mscorlib/test-reflection-02.cs \
|
||||
mscorlib/test-string-01.cs \
|
||||
mscorlib/test-string-02.cs \
|
||||
mscorlib/test-string-03.cs \
|
||||
mscorlib/test-task-01.cs \
|
||||
# mscorlib/test-marshaling.cs \
|
||||
System/test-security.cs
|
||||
|
||||
ifdef MOBILE_PROFILE
|
||||
TEST_CASES += \
|
||||
# Requires linker fix
|
||||
# mscorlib/test-crypto-01.cs
|
||||
mscorlib/test-crypto-01.cs
|
||||
endif
|
||||
|
||||
ifndef AOT_FRIENDLY_PROFILE
|
||||
@@ -33,6 +34,8 @@ SIZE_TEST_CASES :=
|
||||
|
||||
TESTS_COMPILER = $(MCS) -nologo -noconfig -unsafe -debug:portable -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/mscorlib.dll
|
||||
|
||||
MARSHALING_TEST_NATIVE = mscorlib/test-marshaling-native.so
|
||||
|
||||
check: compile-tests
|
||||
$(MAKE) run-tests
|
||||
|
||||
@@ -41,14 +44,31 @@ compile-tests: $(TEST_CASES) $(SIZE_TEST_CASES)
|
||||
mscorlib/test-%.cs:
|
||||
$(TESTS_COMPILER) Tests/$@ /out:Tests/$(@:.cs=.exe)
|
||||
|
||||
$(MARSHALING_TEST_NATIVE): $(@:.so=.c)
|
||||
$(CCOMPILE) Tests/$(@:.so=.c) -shared -o Tests/$@
|
||||
|
||||
mscorlib/test-marshaling.cs: $(MARSHALING_TEST_NATIVE)
|
||||
$(TESTS_COMPILER) Tests/$@ /out:Tests/$(@:.cs=.exe)
|
||||
|
||||
System/test-%.cs:
|
||||
$(TESTS_COMPILER) -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/System.dll Tests/$@ /out:Tests/$(@:.cs=.exe)
|
||||
|
||||
run-tests: $(TEST_CASES:.cs=.exe)
|
||||
|
||||
LINKER_PROFILE_OPTIONS :=
|
||||
|
||||
# Should be in sync with runtime sdk flags
|
||||
ifeq ($(PROFILE),monotouch)
|
||||
LINKER_PROFILE_OPTIONS += --exclude-feature remoting --exclude-feature com
|
||||
endif
|
||||
|
||||
ifeq ($(PROFILE),wasm)
|
||||
LINKER_PROFILE_OPTIONS += --exclude-feature remoting --exclude-feature com --exclude-feature sre
|
||||
endif
|
||||
|
||||
LINKER_OUTPUT := illink-output-$(PROFILE_DIRECTORY)
|
||||
PROFILE_PATH = $(topdir)/class/lib/$(PROFILE_DIRECTORY)
|
||||
LINKER = MONO_PATH=$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE) $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/monolinker.exe -c link -out $(LINKER_OUTPUT) -b true -d $(PROFILE_PATH)
|
||||
LINKER = MONO_PATH=$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE) $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/monolinker.exe -c link -out $(LINKER_OUTPUT) -b true -d $(PROFILE_PATH) $(LINKER_PROFILE_OPTIONS)
|
||||
TEST_EXEC = MONO_PATH=$(LINKER_OUTPUT) $(RUNTIME) $(RUNTIME_FLAGS) --debug -O=-aot
|
||||
|
||||
.NOTPARALLEL:
|
||||
@@ -61,6 +81,15 @@ System/test-%.exe mscorlib/test-%.exe:
|
||||
$(TEST_EXEC) $(LINKER_OUTPUT)/$(@F)
|
||||
@rm -rf $(LINKER_OUTPUT)
|
||||
|
||||
mscorlib/test-marshaling.exe: $(MARSHALING_TEST_NATIVE)
|
||||
@rm -rf $(LINKER_OUTPUT)
|
||||
@mkdir $(LINKER_OUTPUT)
|
||||
@echo Testing $@
|
||||
$(LINKER) -a Tests/$@
|
||||
cp Tests/$(MARSHALING_TEST_NATIVE) $(LINKER_OUTPUT)
|
||||
(cd $(LINKER_OUTPUT); MONO_PATH=. $(RUNTIME) $(RUNTIME_FLAGS) --debug -O=-aot ./$(@F))
|
||||
@rm -rf $(LINKER_OUTPUT)
|
||||
|
||||
BCL_ASSEMBLIES_CORE=mscorlib.dll System.dll System.Core.dll System.Xml.dll
|
||||
BCL_ASSEMBLIES=$(BCL_ASSEMBLIES_CORE) $(sort $(filter-out $(BCL_ASSEMBLIES_CORE), $(notdir $(wildcard $(PROFILE_PATH)/System.*.dll)) ))
|
||||
|
||||
@@ -88,13 +117,15 @@ bcl-size-diff:
|
||||
$(Q) $(MAKE) bcl-size-current PROFILE=net_4_x || true
|
||||
$(Q) $(MAKE) bcl-size-current PROFILE=monotouch || true
|
||||
$(Q) $(MAKE) bcl-size-current PROFILE=monodroid || true
|
||||
$(Q) $(MAKE) bcl-size-current PROFILE=wasm || true
|
||||
@echo "Checking size differences..."
|
||||
@mkdir -p sizediff
|
||||
$(Q) git diff HEAD "*.csv" > temp.patch
|
||||
$(Q) git show HEAD:./net_4_x-linked-size.csv > net_4_x-linked-size.old.csv
|
||||
$(Q) git show HEAD:./monotouch-linked-size.csv > monotouch-linked-size.old.csv
|
||||
$(Q) git show HEAD:./monodroid-linked-size.csv > monodroid-linked-size.old.csv
|
||||
$(Q) sed -e "/@diffdata@/r temp.patch" -e "/@diffdata@/d" -e "/@olddata-net_4_x@/r net_4_x-linked-size.old.csv" -e "/@olddata-net_4_x@/d" -e "/@olddata-monotouch@/r monotouch-linked-size.old.csv" -e "/@olddata-monotouch@/d" -e "/@olddata-monodroid@/r monodroid-linked-size.old.csv" -e "/@olddata-monodroid@/d" -e "/@newdata-net_4_x@/r net_4_x-linked-size.csv" -e "/@newdata-net_4_x@/d" -e "/@newdata-monotouch@/r monotouch-linked-size.csv" -e "/@newdata-monotouch@/d" -e "/@newdata-monodroid@/r monodroid-linked-size.csv" -e "/@newdata-monodroid@/d" linked-size-diff.html.in > sizediff/index.html
|
||||
$(Q) git show HEAD:./wasm-linked-size.csv > wasm-linked-size.old.csv
|
||||
$(Q) sed -e "/@diffdata@/r temp.patch" -e "/@diffdata@/d" -e "/@olddata-net_4_x@/r net_4_x-linked-size.old.csv" -e "/@olddata-net_4_x@/d" -e "/@olddata-monotouch@/r monotouch-linked-size.old.csv" -e "/@olddata-monotouch@/d" -e "/@olddata-monodroid@/r monodroid-linked-size.old.csv" -e "/@olddata-monodroid@/d" -e "/@olddata-wasm@/r wasm-linked-size.old.csv" -e "/@olddata-wasm@/d" -e "/@newdata-net_4_x@/r net_4_x-linked-size.csv" -e "/@newdata-net_4_x@/d" -e "/@newdata-monotouch@/r monotouch-linked-size.csv" -e "/@newdata-monotouch@/d" -e "/@newdata-monodroid@/r monodroid-linked-size.csv" -e "/@newdata-monodroid@/d" -e "/@newdata-wasm@/r wasm-linked-size.csv" -e "/@newdata-wasm@/d" linked-size-diff.html.in > sizediff/index.html
|
||||
$(Q) if [ -s temp.patch ]; then echo "Error: Found BCL Linked Size differences, see mcs/tools/linker/sizediff/index.html."; rm -f temp.patch *.old.csv; exit 1; else echo "No differences found."; rm -f temp.patch *.old.csv; fi
|
||||
|
||||
include ../../build/executable.make
|
||||
|
@@ -37,3 +37,4 @@
|
||||
../../../external/linker/linker/Linker.Steps/TypeMapStep.cs
|
||||
../../../external/linker/linker/Linker.Steps/IStep.cs
|
||||
../../../external/linker/linker/Linker.Steps/AddBypassNGenStep.cs
|
||||
../../../external/linker/linker/Linker.Steps/PreserveDependencyLookupStep.cs
|
||||
|
@@ -18,7 +18,7 @@ typedef struct BundleMonoAPI
|
||||
{
|
||||
void (*mono_register_bundled_assemblies) (const MonoBundledAssembly **assemblies);
|
||||
void (*mono_register_config_for_assembly) (const char* assembly_name, const char* config_xml);
|
||||
void (*mono_jit_set_aot_mode) (int mode);
|
||||
void (*mono_jit_set_aot_mode) (MonoAotMode mode);
|
||||
void (*mono_aot_register_module) (void* aot_info);
|
||||
void (*mono_config_parse_memory) (const char *buffer);
|
||||
void (*mono_register_machine_config) (const char *config_xml);
|
||||
|
@@ -470,7 +470,7 @@ class MakeBundle {
|
||||
// Modern bundling starts here
|
||||
if (!custom_mode){
|
||||
if (runtime != null){
|
||||
// Nothing to do here, the user has chosen to manually specify --runtime nad libraries
|
||||
// Nothing to do here, the user has chosen to manually specify --runtime and libraries
|
||||
} else if (sdk_path != null) {
|
||||
VerifySdk (sdk_path);
|
||||
} else if (cross_target == "default" || cross_target == null){
|
||||
@@ -655,15 +655,28 @@ class MakeBundle {
|
||||
|
||||
class PackageMaker {
|
||||
Dictionary<string, Tuple<long,int>> locations = new Dictionary<string, Tuple<long,int>> ();
|
||||
const int align = 4096;
|
||||
int align = 4096; // first non-Windows alignment, saving on average 30K
|
||||
Stream package;
|
||||
|
||||
public PackageMaker (string output)
|
||||
public PackageMaker (string runtime, string output)
|
||||
{
|
||||
package = File.Create (output, 128*1024);
|
||||
if (IsUnix){
|
||||
File.SetAttributes (output, unchecked ((FileAttributes) 0x80000000));
|
||||
}
|
||||
|
||||
Console.WriteLine ("Using runtime: " + runtime);
|
||||
|
||||
// Probe for MZ signature to decide if we are targeting Windows,
|
||||
// so we can optimize an average of 30K away on Unix.
|
||||
using (Stream runtimeStream = File.OpenRead (runtime)) {
|
||||
var runtimeBuffer = new byte [2];
|
||||
if (runtimeStream.Read (runtimeBuffer, 0, 2) == 2
|
||||
&& runtimeBuffer [0] == (byte)'M'
|
||||
&& runtimeBuffer [1] == (byte)'Z')
|
||||
align = 1 << 16; // first Windows alignment
|
||||
}
|
||||
AddFile (runtime);
|
||||
}
|
||||
|
||||
public int AddFile (string fname)
|
||||
@@ -675,6 +688,7 @@ class MakeBundle {
|
||||
Console.WriteLine ("At {0:x} with input {1}", package.Position, fileStream.Length);
|
||||
fileStream.CopyTo (package);
|
||||
package.Position = package.Position + (align - (package.Position % align));
|
||||
align = 4096; // rest of alignment for all systems
|
||||
return (int) ret;
|
||||
}
|
||||
}
|
||||
@@ -688,14 +702,17 @@ class MakeBundle {
|
||||
|
||||
public void AddString (string entry, string text)
|
||||
{
|
||||
// FIXME Strings are over-aligned?
|
||||
var bytes = Encoding.UTF8.GetBytes (text);
|
||||
locations [entry] = Tuple.Create (package.Position, bytes.Length);
|
||||
package.Write (bytes, 0, bytes.Length);
|
||||
package.WriteByte (0);
|
||||
package.Position = package.Position + (align - (package.Position % align));
|
||||
}
|
||||
|
||||
public void AddStringPair (string entry, string key, string value)
|
||||
{
|
||||
// FIXME Strings are over-aligned?
|
||||
var kbytes = Encoding.UTF8.GetBytes (key);
|
||||
var vbytes = Encoding.UTF8.GetBytes (value);
|
||||
|
||||
@@ -785,9 +802,7 @@ class MakeBundle {
|
||||
return false;
|
||||
}
|
||||
|
||||
var maker = new PackageMaker (output);
|
||||
Console.WriteLine ("Using runtime: " + runtime);
|
||||
maker.AddFile (runtime);
|
||||
var maker = new PackageMaker (runtime, output);
|
||||
|
||||
foreach (var url in files){
|
||||
string fname = LocateFile (new Uri (url).LocalPath);
|
||||
@@ -884,6 +899,7 @@ typedef struct {
|
||||
template_stream.Dispose ();
|
||||
|
||||
if (compress) {
|
||||
tc.WriteLine ("#define USE_COMPRESSED_ASSEMBLY\n");
|
||||
tc.WriteLine ("typedef struct _compressed_data {");
|
||||
tc.WriteLine ("\tMonoBundledAssembly assembly;");
|
||||
tc.WriteLine ("\tint compressed_size;");
|
||||
@@ -973,7 +989,7 @@ typedef struct {
|
||||
FileStream cf = File.OpenRead (fname + ".config");
|
||||
if (!quiet)
|
||||
Console.WriteLine (" config from: " + fname + ".config");
|
||||
tc.WriteLine ("extern const unsigned char assembly_config_{0} [];", encoded);
|
||||
tc.WriteLine ("extern const char assembly_config_{0} [];", encoded);
|
||||
WriteSymbol (ts, "assembly_config_" + encoded, cf.Length);
|
||||
WriteBuffer (ts, cf, buffer);
|
||||
ts.WriteLine ();
|
||||
@@ -1044,7 +1060,8 @@ typedef struct {
|
||||
tc.WriteLine ("\textern const void *mono_aot_module_{0}_info;", asm);
|
||||
}
|
||||
|
||||
tc.WriteLine ("\nstatic void install_aot_modules (void) {\n");
|
||||
tc.WriteLine ("\n#ifndef USE_COMPRESSED_ASSEMBLY\n");
|
||||
tc.WriteLine ("static void install_aot_modules (void) {\n");
|
||||
foreach (string asm in aot_names){
|
||||
tc.WriteLine ("\tmono_api.mono_aot_register_module (mono_aot_module_{0}_info);\n", asm);
|
||||
}
|
||||
@@ -1066,6 +1083,7 @@ typedef struct {
|
||||
tc.WriteLine ("\tmono_api.mono_jit_set_aot_mode ({0});", enum_aot_mode);
|
||||
|
||||
tc.WriteLine ("\n}\n");
|
||||
tc.WriteLine ("#endif\n");
|
||||
|
||||
|
||||
tc.WriteLine ("static char *image_name = \"{0}\";", prog);
|
||||
|
@@ -18,6 +18,8 @@ void initialize_mono_api (const BundleMonoAPI *info)
|
||||
mono_api.mono_register_machine_config = info->mono_register_machine_config;
|
||||
}
|
||||
|
||||
#ifdef USE_COMPRESSED_ASSEMBLY
|
||||
|
||||
static int
|
||||
validate_api_pointer (const char *name, void *ptr)
|
||||
{
|
||||
@@ -47,6 +49,12 @@ validate_api_struct ()
|
||||
exit (1);
|
||||
}
|
||||
|
||||
#ifdef USE_DEFAULT_MONO_API_STRUCT
|
||||
// We don't export in jit.h
|
||||
// So declare here, and get it from mono
|
||||
void mono_aot_register_module (void *aot_info);
|
||||
#endif // USE_DEFAULT_MONO_API_STRUCT
|
||||
|
||||
static void
|
||||
init_default_mono_api_struct ()
|
||||
{
|
||||
@@ -59,3 +67,5 @@ init_default_mono_api_struct ()
|
||||
mono_api.mono_register_machine_config = mono_register_machine_config;
|
||||
#endif // USE_DEFAULT_MONO_API_STRUCT
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -69,9 +69,9 @@ namespace Mono.ApiTools {
|
||||
if (!change.HasIgnoredChanges) {
|
||||
var isField = source.Name.LocalName == "field";
|
||||
if (isField) {
|
||||
State.LogDebugMessage ($"Comparison resulting in no changes (src: {source.GetFieldAttributes ()} dst: {target.GetFieldAttributes ()}) :\n{source}\n{target}\n\n");
|
||||
State.LogDebugMessage ($"Comparison resulting in no changes (src: {source.GetFieldAttributes ()} dst: {target.GetFieldAttributes ()}) :{Environment.NewLine}{source}{Environment.NewLine}{target}{Environment.NewLine}{Environment.NewLine}");
|
||||
} else {
|
||||
State.LogDebugMessage ($"Comparison resulting in no changes (src: {source.GetMethodAttributes ()} dst: {target.GetMethodAttributes ()}) :\n{source}\n{target}\n\n");
|
||||
State.LogDebugMessage ($"Comparison resulting in no changes (src: {source.GetMethodAttributes ()} dst: {target.GetMethodAttributes ()}) :{Environment.NewLine}{source}{Environment.NewLine}{target}{Environment.NewLine}{Environment.NewLine}");
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@@ -56,9 +56,9 @@ namespace Mono.ApiTools {
|
||||
if (srcNotSerialized != tgtNotSerialized) {
|
||||
// this is not a breaking change, so only render it if it changed.
|
||||
if (srcNotSerialized) {
|
||||
change.AppendRemoved ("[NonSerialized]\n");
|
||||
change.AppendRemoved ($"[NonSerialized]{Environment.NewLine}");
|
||||
} else {
|
||||
change.AppendAdded ("[NonSerialized]\n");
|
||||
change.AppendAdded ($"[NonSerialized]{Environment.NewLine}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -235,7 +235,7 @@ namespace Mono.ApiTools {
|
||||
output.WriteLine ("<p>Removed value{0}:</p>", list.Count () > 1 ? "s" : String.Empty);
|
||||
output.WriteLine ("<pre class='removed' data-is-breaking>");
|
||||
} else {
|
||||
output.WriteLine ("<p>Removed {0}:</p>\n", list.Count () > 1 ? member.GroupName : member.ElementName);
|
||||
output.WriteLine ("<p>Removed {0}:</p>", list.Count () > 1 ? member.GroupName : member.ElementName);
|
||||
output.WriteLine ("<pre>");
|
||||
}
|
||||
State.Indent++;
|
||||
@@ -303,7 +303,7 @@ namespace Mono.ApiTools {
|
||||
public override void Diff (TextWriter output, ApiChange apichange)
|
||||
{
|
||||
output.Write ("<div {0}>", apichange.Breaking ? "data-is-breaking" : "data-is-non-breaking");
|
||||
foreach (var line in apichange.Member.ToString ().Split ('\n')) {
|
||||
foreach (var line in apichange.Member.ToString ().Split (new[] { Environment.NewLine }, 0)) {
|
||||
output.Write ('\t');
|
||||
output.WriteLine (line);
|
||||
}
|
||||
|
@@ -191,7 +191,7 @@ namespace Mono.ApiTools {
|
||||
|
||||
public override void Diff (TextWriter output, ApiChange apichange)
|
||||
{
|
||||
foreach (var line in apichange.Member.ToString ().Split ('\n')) {
|
||||
foreach (var line in apichange.Member.ToString ().Split (new[] { Environment.NewLine }, 0)) {
|
||||
if (line.Contains ("+++")) {
|
||||
output.WriteLine ("-{0}", Clean (line, "+++", "---"));
|
||||
output.WriteLine ("+{0}", Clean (line, "---", "+++"));
|
||||
|
@@ -16,7 +16,7 @@ MONO = MONO_PATH="$(LIB_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) -
|
||||
|
||||
MSYM_DIR = $(OUT_DIR)/msymdir
|
||||
TEST_CS = Test/StackTraceDumper.cs
|
||||
TEST_EXE = $(OUT_DIR)/StackTraceDumper.exe
|
||||
TEST_EXE = StackTraceDumper.exe
|
||||
STACKTRACE_FILE = $(OUT_DIR)/stacktrace.out
|
||||
SYMBOLICATE_RAW_FILE = $(OUT_DIR)/symbolicate_raw.out
|
||||
SYMBOLICATE_RESULT_FILE = $(OUT_DIR)/symbolicate.result
|
||||
@@ -44,22 +44,31 @@ PREPARE_OUTDIR = @\
|
||||
mkdir -p $(OUT_DIR); \
|
||||
mkdir -p $(MSYM_DIR);
|
||||
|
||||
COMPILE = \
|
||||
$(CSCOMPILE) $(TEST_CS) -r:$(LIB_PATH)/mscorlib.dll -r:$(LIB_PATH)/System.Core.dll -warn:0 -out:$(TEST_EXE); \
|
||||
STORE_SYMBOLS = \
|
||||
$(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(OUT_DIR); \
|
||||
$(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(LIB_PATH);
|
||||
|
||||
COPY_TEST = @\
|
||||
cp $(TEST_EXE) $(OUT_DIR); \
|
||||
cp $(TEST_EXE:.exe=.pdb) $(OUT_DIR);
|
||||
|
||||
check: run-test
|
||||
|
||||
AOT_SUPPORTED = $(shell $(MONO) --aot 2>&1 | grep -q "AOT compilation is not supported" && echo 0 || echo 1)
|
||||
|
||||
test-local: $(TEST_EXE)
|
||||
|
||||
$(TEST_EXE): $(TEST_CS)
|
||||
$(CSCOMPILE) $(TEST_CS) -r:$(LIB_PATH)/mscorlib.dll -r:$(LIB_PATH)/System.Core.dll -warn:0 -out:$(TEST_EXE)
|
||||
|
||||
run-test-local: run-test-without-aot run-test-with-aot run-test-with-aot-msym
|
||||
|
||||
run-test-without-aot: OUT_DIR = Test/without_aot
|
||||
run-test-without-aot: all
|
||||
@echo "Checking $(TEST_EXE) without AOT in $(OUT_DIR)"
|
||||
$(PREPARE_OUTDIR)
|
||||
$(COMPILE)
|
||||
$(COPY_TEST)
|
||||
$(STORE_SYMBOLS)
|
||||
$(CHECK_DIFF)
|
||||
|
||||
run-test-with-aot: OUT_DIR = Test/with_aot
|
||||
@@ -67,8 +76,9 @@ run-test-with-aot: all
|
||||
ifeq ($(AOT_SUPPORTED), 1)
|
||||
@echo "Checking $(TEST_EXE) with AOT in $(OUT_DIR)"
|
||||
$(PREPARE_OUTDIR)
|
||||
$(COMPILE)
|
||||
@$(MONO) --aot $(TEST_EXE) > /dev/null
|
||||
$(COPY_TEST)
|
||||
$(STORE_SYMBOLS)
|
||||
@$(MONO) --aot $(OUT_DIR)/$(TEST_EXE) > /dev/null
|
||||
$(CHECK_DIFF)
|
||||
endif
|
||||
|
||||
@@ -77,7 +87,8 @@ run-test-with-aot-msym: all
|
||||
ifeq ($(AOT_SUPPORTED), 1)
|
||||
@echo "Checking $(TEST_EXE) with AOT (using .msym) in $(OUT_DIR)"
|
||||
$(PREPARE_OUTDIR)
|
||||
$(COMPILE)
|
||||
@$(MONO) --aot=msym-dir=$(MSYM_DIR) $(TEST_EXE) > /dev/null
|
||||
$(COPY_TEST)
|
||||
$(STORE_SYMBOLS)
|
||||
@$(MONO) --aot=msym-dir=$(MSYM_DIR) $(OUT_DIR)/$(TEST_EXE) > /dev/null
|
||||
$(CHECK_DIFF)
|
||||
endif
|
||||
|
@@ -1,13 +1,13 @@
|
||||
XBUILD_DATA_DIR=$(topdir)/tools/xbuild/data
|
||||
XBUILD_PROFILE_DIR=$(topdir)/class/lib/$(PROFILE)
|
||||
XBUILD_TESTING_DIR=$(topdir)/class/lib/net_4_x/tests/xbuild
|
||||
|
||||
# makes xbuild look in the class/lib/$PROFILE build directories for targets etc
|
||||
export TESTING_MONO=a
|
||||
export MSBuildExtensionsPath=$(XBUILD_DATA_DIR)
|
||||
export XBUILD_FRAMEWORK_FOLDERS_PATH= $(topdir)/class/Microsoft.Build/xbuild-testing
|
||||
export MSBuildExtensionsPath=$(XBUILD_TESTING_DIR)/extensions
|
||||
export XBUILD_FRAMEWORK_FOLDERS_PATH=$(XBUILD_TESTING_DIR)/frameworks
|
||||
|
||||
test-local: copy-targets Test/test-config-file-$(PROFILE)
|
||||
clean-local: clean-targets clean-test-config
|
||||
test-local: copy-targets copy-data copy-frameworks Test/test-config-file-$(PROFILE)
|
||||
clean-local: clean-targets clean-data clean-frameworks clean-test-config
|
||||
|
||||
Test/test-config-file-$(PROFILE): $(XBUILD_DATA_DIR)/xbuild.exe.config_test.in
|
||||
sed -e 's/@ASM_VERSION@/$(XBUILD_ASSEMBLY_VERSION)/g' $(XBUILD_DATA_DIR)/xbuild.exe.config_test.in > Test/test-config-file-$(PROFILE)
|
||||
@@ -23,6 +23,14 @@ XBUILD_4_0_PROFILE_DIR=$(topdir)/class/lib/net_4_x
|
||||
XBUILD_12_0_PROFILE_DIR=$(topdir)/class/lib/xbuild_12
|
||||
XBUILD_14_0_PROFILE_DIR=$(topdir)/class/lib/xbuild_14
|
||||
|
||||
copy-data:
|
||||
mkdir -p $(XBUILD_TESTING_DIR)/extensions
|
||||
cp -R -L $(XBUILD_DATA_DIR)/. $(XBUILD_TESTING_DIR)/extensions
|
||||
|
||||
copy-frameworks:
|
||||
mkdir -p $(XBUILD_TESTING_DIR)/frameworks
|
||||
cp -R -L $(topdir)/class/Microsoft.Build/xbuild-testing/. $(XBUILD_TESTING_DIR)/frameworks
|
||||
|
||||
copy-targets-4.0:
|
||||
cp $(XBUILD_DATA_DIR)/4.0/Microsoft.Common.targets $(XBUILD_4_0_PROFILE_DIR)
|
||||
cp $(XBUILD_DATA_DIR)/4.0/Microsoft.Common.tasks $(XBUILD_4_0_PROFILE_DIR)
|
||||
@@ -41,6 +49,12 @@ copy-targets-14.0:
|
||||
cp $(XBUILD_DATA_DIR)/14.0/Microsoft.CSharp.targets $(XBUILD_14_0_PROFILE_DIR)
|
||||
cp $(XBUILD_DATA_DIR)/Microsoft.VisualBasic.targets $(XBUILD_14_0_PROFILE_DIR)
|
||||
|
||||
clean-data:
|
||||
rm -rf $(XBUILD_TESTING_DIR)/extensions
|
||||
|
||||
clean-frameworks:
|
||||
rm -rf $(XBUILD_TESTING_DIR)/frameworks
|
||||
|
||||
clean-targets-4.0:
|
||||
rm -f $(XBUILD_4_0_PROFILE_DIR)/Microsoft.Common.targets
|
||||
rm -f $(XBUILD_4_0_PROFILE_DIR)/Microsoft.Common.tasks
|
||||
|
Reference in New Issue
Block a user