Skip to content

Commit aabdfb7

Browse files
committed
Initial commit for public, open source repo
0 parents  commit aabdfb7

File tree

165 files changed

+23369
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+23369
-0
lines changed

CMakeLists.txt

Lines changed: 619 additions & 0 deletions
Large diffs are not rendered by default.

CSharpTestDriver.cs.in

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
class MummyCSharpTestDriver
2+
{
3+
public static void Main(string[] args)
4+
{
5+
try
6+
{
7+
string test;
8+
9+
if (0 == args.Length)
10+
{
11+
test = GetTestNameInteractively();
12+
}
13+
else
14+
{
15+
test = args[0];
16+
}
17+
18+
System.Type t = System.Type.GetType(test + "Class");
19+
if (null == t)
20+
{
21+
throw new System.ArgumentException(System.String.Format(
22+
"error: could not create a Type object for '{0}'...\n\n{1}\n{2}\n{3}\n{4}\n\n{5}\n\n",
23+
test + "Class",
24+
"Typo?",
25+
"Did you follow the C# test driver naming convention?",
26+
"Did you add the test to the CMakeLists.txt file?",
27+
"Did you reconfigure/rebuild after adding the test?",
28+
"Test 'method' name should equal 'file name without extension'... Test 'public class' name should be the same but with 'Class' appended..."
29+
));
30+
}
31+
32+
System.Reflection.MethodInfo mi = t.GetMethod(test);
33+
if (null == mi)
34+
{
35+
throw new System.ArgumentException(System.String.Format(
36+
"error: could not find method named '{0}'", test));
37+
}
38+
39+
// Expected method signature is "same as C# Main": returns void
40+
// and takes a string array as its one argument...
41+
//
42+
object[] invArgs = new object[1];
43+
invArgs[0] = args;
44+
mi.Invoke(null, invArgs);
45+
46+
// Before forced garbage collection, make sure the mummy Runtime
47+
// is not holding onto any wrapper objects anymore:
48+
//
49+
Kitware.mummy.Runtime.Methods.ForceRemoveCallbacks();
50+
Kitware.mummy.Runtime.Methods.ForceClearWrappedObjectsTable();
51+
52+
// Force a garbage collection prior to exiting the test
53+
// so that any memory leaks reported are likely to be
54+
// *actual* leaks of some sort rather than false reports:
55+
//
56+
System.GC.Collect();
57+
System.GC.WaitForPendingFinalizers();
58+
59+
// Test finished without throwing any exceptions...
60+
// Therefore, it passed. Exit with a zero ExitCode.
61+
//
62+
System.Environment.ExitCode = 0;
63+
}
64+
catch(System.Exception exc)
65+
{
66+
// Catch anything, spit it out to the console so it can be captured
67+
// by ctest. Exit with a non-zero ExitCode.
68+
//
69+
System.Console.Error.WriteLine("================================================================================");
70+
System.Console.Error.WriteLine("");
71+
System.Console.Error.WriteLine("Mummy C# test driver caught System.Exception:");
72+
System.Console.Error.WriteLine("");
73+
System.Console.Error.WriteLine("{0}", exc.ToString());
74+
System.Console.Error.WriteLine("");
75+
System.Console.Error.WriteLine("================================================================================");
76+
System.Console.Error.WriteLine("");
77+
System.Environment.ExitCode = 2345;
78+
}
79+
}
80+
81+
public static string[] GetAvailableTests()
82+
{
83+
System.Collections.ArrayList testList = new System.Collections.ArrayList();
84+
System.Reflection.Assembly assy = System.Reflection.Assembly.GetExecutingAssembly();
85+
86+
foreach (System.Type et in assy.GetExportedTypes())
87+
{
88+
if (et.IsClass)
89+
{
90+
foreach (System.Reflection.MethodInfo mInfo in et.GetMethods())
91+
{
92+
if (et.Name == mInfo.Name + "Class")
93+
{
94+
testList.Add(mInfo.Name);
95+
}
96+
}
97+
}
98+
}
99+
100+
return (string[])testList.ToArray(System.Type.GetType("System.String"));
101+
}
102+
103+
public static string GetTestNameInteractively()
104+
{
105+
string s = "Available tests:\n";
106+
107+
string[] tests = GetAvailableTests();
108+
109+
int i = 0;
110+
foreach (string xyz in tests)
111+
{
112+
s = System.String.Format("{0} {1}: {2}\n", s, i, xyz);
113+
++i;
114+
}
115+
116+
s = System.String.Format("{0}To run a test, enter the test number: ", s);
117+
118+
System.Console.Write(s);
119+
120+
string choice = System.Console.ReadLine();
121+
122+
int choiceNumber = -1;
123+
try
124+
{
125+
choiceNumber = System.Convert.ToInt32(choice);
126+
127+
if (choiceNumber < 0 || choiceNumber >= tests.Length)
128+
{
129+
throw new System.ArgumentOutOfRangeException(System.String.Format(
130+
"'{0}' is an invalid test number.\nExiting without running a test.\n\n",
131+
choice));
132+
}
133+
}
134+
catch (System.Exception)
135+
{
136+
System.Console.Error.Write(System.String.Format(
137+
"'{0}' is an invalid test number.\nExiting without running a test.\n\n",
138+
choice));
139+
140+
throw;
141+
}
142+
143+
return tests[choiceNumber];
144+
}
145+
}

CTestConfig.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(CTEST_PROJECT_NAME "mummy")
2+
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
3+
4+
set(CTEST_DROP_METHOD "http")
5+
set(CTEST_DROP_SITE "www.cdash.org")
6+
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=mummy")
7+
set(CTEST_DROP_SITE_CDASH TRUE)

CTestCustom.cmake.in

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#SET(CTEST_CUSTOM_WARNING_MATCH
2+
# ${CTEST_CUSTOM_WARNING_MATCH}
3+
# )
4+
5+
#SET(CTEST_CUSTOM_ERROR_MATCH
6+
# ${CTEST_CUSTOM_ERROR_MATCH}
7+
# )
8+
9+
SET(CTEST_CUSTOM_WARNING_EXCEPTION
10+
${CTEST_CUSTOM_WARNING_EXCEPTION}
11+
"(ranlib|libtool).*file.*(backend|cpp).*has no symbols"
12+
"arning.*description field.*too big.*try a different debug format"
13+
"CableSwig.GCC.gcc.config.i386.i386.md.*warning: operand 1 missing mode"
14+
"(insn-peep|loop-doloop|vmsdbgout|xcoffout).*obj.*warning.*no public symbols found.*archive member will be inaccessible"
15+
"mummyExternalSourceTrees.CableSwig.Cable.Expat.xmlrole.c.*warning.*RCSId.*defined but not used"
16+
)
17+
18+
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
19+
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
20+
".*CableSwig.*"
21+
".*CMakeFiles.CMakeTmp.*"
22+
".*Modules.CMake.*"
23+
".*Modules.(CheckFunctionExists|TestBigEndian).c$"
24+
".*MummyTesting.(HandCrafted|Simple|SuppressWarnings).*"
25+
)

ConfigureAndBuild.cmake.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SET(CTEST_PROJECT_NAME "@MCAB_PROJECT@")
2+
SET(CTEST_SOURCE_DIRECTORY "@MCAB_SOURCE_DIR@")
3+
SET(CTEST_BINARY_DIRECTORY "@MCAB_BINARY_DIR@")
4+
SET(CTEST_CMAKE_GENERATOR "@MCAB_GENERATOR@")
5+
SET(CTEST_BUILD_CONFIGURATION "@MCAB_CONFIG@")
6+
7+
IF(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
8+
FILE(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
9+
EXECUTABLE_OUTPUT_PATH:PATH=@MCAB_EXECUTABLE_OUTPUT_PATH@
10+
LIBRARY_OUTPUT_PATH:PATH=@MCAB_LIBRARY_OUTPUT_PATH@
11+
Mummy_64_JUST_BUILD_RUNTIME:BOOL=@MCAB_Mummy_64_JUST_BUILD_RUNTIME@
12+
Mummy_SNKEYFILE:FILEPATH=@MCAB_Mummy_SNKEYFILE@
13+
")
14+
ENDIF(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
15+
16+
CTEST_START(Experimental)
17+
CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}")
18+
CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}")

CvsMacros.cmake

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
MACRO(GET_CVS_SNAPSHOT gcs_workingdir gcs_cvsroot gcs_cvsmodule gcs_cvsrevisionargs)
2+
FIND_PROGRAM(gcs_cvs_EXECUTABLE cvs
3+
"C:/Program Files/CVSNT"
4+
"C:/Program Files (x86)/CVSNT"
5+
"C:/Program Files/TortoiseCVS"
6+
"C:/Program Files (x86)/TortoiseCVS"
7+
"C:/cygwin/bin"
8+
"/usr/bin"
9+
"/usr/local/bin"
10+
)
11+
IF(NOT gcs_cvs_EXECUTABLE)
12+
MESSAGE(FATAL_ERROR "error: cvs is required to retrieve a ${gcs_cvsmodule} snapshot. Please set gcs_cvs_EXECUTABLE to a working copy of cvs.")
13+
ENDIF(NOT gcs_cvs_EXECUTABLE)
14+
MARK_AS_ADVANCED(gcs_cvs_EXECUTABLE)
15+
16+
IF(EXISTS "${gcs_workingdir}/${gcs_cvsmodule}/CVS/Root")
17+
18+
MESSAGE(STATUS "Updating ${gcs_cvsmodule} snapshot with '${gcs_cvs_EXECUTABLE}'...")
19+
SET(gcs_cvsargs "-d" "${gcs_cvsroot}" "up" "-dAP" ${gcs_cvsrevisionargs})
20+
FILE(APPEND "${gcs_workingdir}/${gcs_cvsmodule}/CMakeFiles/cvs-up-args.txt" "gcs_cvsargs='${gcs_cvsargs}'\n")
21+
EXECUTE_PROCESS(
22+
COMMAND "${gcs_cvs_EXECUTABLE}" ${gcs_cvsargs}
23+
WORKING_DIRECTORY "${gcs_workingdir}/${gcs_cvsmodule}"
24+
RESULT_VARIABLE gcs_cvs_rv
25+
)
26+
MESSAGE(STATUS "Updating ${gcs_cvsmodule} snapshot with '${gcs_cvs_EXECUTABLE}'... -- done")
27+
28+
ELSE(EXISTS "${gcs_workingdir}/${gcs_cvsmodule}/CVS/Root")
29+
30+
MESSAGE(STATUS "Checking out ${gcs_cvsmodule} snapshot with '${gcs_cvs_EXECUTABLE}'... (This may take a few minutes...)")
31+
SET(gcs_cvsargs "-d" "${gcs_cvsroot}" "co" ${gcs_cvsrevisionargs} "${gcs_cvsmodule}")
32+
FILE(WRITE "${gcs_workingdir}/${gcs_cvsmodule}/CMakeFiles/cvs-co-args.txt" "gcs_cvsargs='${gcs_cvsargs}'\n")
33+
EXECUTE_PROCESS(
34+
COMMAND "${gcs_cvs_EXECUTABLE}" ${gcs_cvsargs}
35+
WORKING_DIRECTORY "${gcs_workingdir}"
36+
RESULT_VARIABLE gcs_cvs_rv
37+
)
38+
MESSAGE(STATUS "Checking out ${gcs_cvsmodule} snapshot with '${gcs_cvs_EXECUTABLE}'... -- done")
39+
40+
ENDIF(EXISTS "${gcs_workingdir}/${gcs_cvsmodule}/CVS/Root")
41+
42+
IF(NOT "${gcs_cvs_rv}" STREQUAL "0")
43+
MESSAGE(SEND_ERROR "error: cvs command returned '${gcs_cvs_rv}'")
44+
ENDIF(NOT "${gcs_cvs_rv}" STREQUAL "0")
45+
ENDMACRO(GET_CVS_SNAPSHOT)

DoConfigureAndBuild.cmake

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
GET_FILENAME_COMPONENT(dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
2+
3+
SET(CMAKE_BACKWARDS_COMPATIBILITY ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
4+
5+
FOREACH(v
6+
CMAKE_BACKWARDS_COMPATIBILITY
7+
CMAKE_CTEST_COMMAND
8+
CMAKE_CURRENT_LIST_FILE
9+
CMAKE_MAJOR_VERSION
10+
CMAKE_MINOR_VERSION
11+
dir
12+
MCAB_BINARY_DIR
13+
MCAB_CONFIG
14+
MCAB_EXECUTABLE_OUTPUT_PATH
15+
MCAB_GENERATOR
16+
MCAB_LIBRARY_OUTPUT_PATH
17+
MCAB_Mummy_64_JUST_BUILD_RUNTIME
18+
MCAB_Mummy_SNKEYFILE
19+
MCAB_PROJECT
20+
MCAB_SCRIPT
21+
MCAB_SOURCE_DIR
22+
)
23+
#MESSAGE("${v}='${${v}}'")
24+
ENDFOREACH(v)
25+
26+
CONFIGURE_FILE(
27+
"${dir}/ConfigureAndBuild.cmake.in"
28+
"${MCAB_SCRIPT}"
29+
@ONLY
30+
)
31+
32+
EXECUTE_PROCESS(COMMAND ${CMAKE_CTEST_COMMAND}
33+
-VV -C "${MCAB_CONFIG}" -S "${MCAB_SCRIPT}"
34+
)

Examples/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SET(Vehicles_BUILD_TESTING 1)
2+
ADD_SUBDIRECTORY(Vehicles)

0 commit comments

Comments
 (0)