Modified: branches/xmlbuildsystem/reactos/Makefile
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
Modified: branches/xmlbuildsystem/reactos/baseaddress.xml
Modified: branches/xmlbuildsystem/reactos/lib/kernel32/kernel32.xml
Added: branches/xmlbuildsystem/reactos/lib/kernel32/tests/kernel32.xml
Added: branches/xmlbuildsystem/reactos/lib/kernel32/tests/stubs.xml
Added: branches/xmlbuildsystem/reactos/regtests/directory.xml
Added: branches/xmlbuildsystem/reactos/regtests/regtests/regtests.xml
Added: branches/xmlbuildsystem/reactos/regtests/shared/rtshared.xml
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.mak
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt
Added: branches/xmlbuildsystem/reactos/tools/rbuild/stubbedcomponent.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/test.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/symbol.xml
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/functiontest.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/invoketest.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/sourcefiletest.cpp
Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/symboltest.cpp
--- branches/xmlbuildsystem/reactos/Makefile 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/Makefile 2005-03-20 21:58:30 UTC (rev 14241)
@@ -45,47 +45,49 @@
endif
endif
ifeq ($(HALFVERBOSEECHO),yes)
- ECHO_MKDIR =@echo [MKDIR] $@
- ECHO_BUILDNO=@echo [BUILDNO] $@
- ECHO_INVOKE =@echo [INVOKE] $<
- ECHO_PCH =@echo [PCH] $@
- ECHO_CC =@echo [CC] $<
- ECHO_GAS =@echo [GAS] $<
- ECHO_NASM =@echo [NASM] $<
- ECHO_AR =@echo [AR] $@
- ECHO_WINEBLD=@echo [WINEBLD] $@
- ECHO_WRC =@echo [WRC] $@
- ECHO_BIN2RES=@echo [BIN2RES] $<
- ECHO_DLLTOOL=@echo [DLLTOOL] $@
- ECHO_LD =@echo [LD] $@
- ECHO_RBUILD =@echo [RBUILD] $@
- ECHO_RSYM =@echo [RSYM] $@
- ECHO_WMC =@echo [WMC] $@
- ECHO_NCI =@echo [NCI] $@
- ECHO_CABMAN =@echo [CABMAN] $<
- ECHO_CDMAKE =@echo [CDMAKE] $@
- ECHO_TEST =@echo [TEST] $@
+ ECHO_MKDIR =@echo [MKDIR] $@
+ ECHO_BUILDNO =@echo [BUILDNO] $@
+ ECHO_INVOKE =@echo [INVOKE] $<
+ ECHO_PCH =@echo [PCH] $@
+ ECHO_CC =@echo [CC] $<
+ ECHO_GAS =@echo [GAS] $<
+ ECHO_NASM =@echo [NASM] $<
+ ECHO_AR =@echo [AR] $@
+ ECHO_WINEBLD =@echo [WINEBLD] $@
+ ECHO_WRC =@echo [WRC] $@
+ ECHO_BIN2RES =@echo [BIN2RES] $<
+ ECHO_DLLTOOL =@echo [DLLTOOL] $@
+ ECHO_LD =@echo [LD] $@
+ ECHO_RBUILD =@echo [RBUILD] $@
+ ECHO_RSYM =@echo [RSYM] $@
+ ECHO_WMC =@echo [WMC] $@
+ ECHO_NCI =@echo [NCI] $@
+ ECHO_CABMAN =@echo [CABMAN] $<
+ ECHO_CDMAKE =@echo [CDMAKE] $@
+ ECHO_REGTESTS=@echo [REGTESTS] $@
+ ECHO_TEST =@echo [TEST] $@
else
- ECHO_MKDIR =
- ECHO_BUILDNO=
- ECHO_INVOKE =
- ECHO_PCH =
- ECHO_CC =
- ECHO_GAS =
- ECHO_NASM =
- ECHO_AR =
- ECHO_WINEBLD=
- ECHO_WRC =
- ECHO_BIN2RES=
- ECHO_DLLTOOL=
- ECHO_LD =
- ECHO_RBUILD =
- ECHO_RSYM =
- ECHO_WMC =
- ECHO_NCI =
- ECHO_CABMAN =
- ECHO_CDMAKE =
- ECHO_TEST =
+ ECHO_MKDIR =
+ ECHO_BUILDNO =
+ ECHO_INVOKE =
+ ECHO_PCH =
+ ECHO_CC =
+ ECHO_GAS =
+ ECHO_NASM =
+ ECHO_AR =
+ ECHO_WINEBLD =
+ ECHO_WRC =
+ ECHO_BIN2RES =
+ ECHO_DLLTOOL =
+ ECHO_LD =
+ ECHO_RBUILD =
+ ECHO_RSYM =
+ ECHO_WMC =
+ ECHO_NCI =
+ ECHO_CABMAN =
+ ECHO_CDMAKE =
+ ECHO_REGTESTS=
+ ECHO_TEST =
endif
--- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -47,6 +47,9 @@
<directory name="ntoskrnl">
<xi:include href="ntoskrnl/ntoskrnl.xml" />
</directory>
+ <directory name="regtests">
+ <xi:include href="regtests/directory.xml" />
+ </directory>
<directory name="services">
<xi:include href="services/directory.xml" />
</directory>
--- branches/xmlbuildsystem/reactos/baseaddress.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/baseaddress.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -1,3 +1,4 @@
+<property name="BASEADDRESS_REGTESTS" value="0x07000000" />
<property name="BASEADDRESS_NOTIFYHOOK" value="0x08000000" />
<property name="BASEADDRESS_DEVENUM" value="0x35680000" />
<property name="BASEADDRESS_DINPUT" value="0x5F580000" />
--- branches/xmlbuildsystem/reactos/lib/kernel32/kernel32.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/lib/kernel32/kernel32.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -1,16 +1,9 @@
-<module name="kernel32" type="win32dll" baseaddress="${BASEADDRESS_KERNEL32}">
- <importlibrary definition="kernel32.def" />
- <include base="kernel32">.</include>
- <include base="kernel32">include</include>
+<module name="kernel32_base" type="objectlibrary">
+ <include base="kernel32_base">.</include>
+ <include base="kernel32_base">include</include>
<define name="_DISABLE_TIDENTS" />
<define name="_SEH_NO_NATIVE_NLG" />
<define name="WINVER">0x0500</define>
- <library>pseh</library>
- <library>rosrtl</library>
- <library>ntdll</library>
- <linkerflag>-lgcc</linkerflag>
- <linkerflag>-nostartfiles</linkerflag>
- <linkerflag>-nostdlib</linkerflag>
<pch>k32.h</pch>
<directory name="debug">
<file>break.c</file>
@@ -109,6 +102,25 @@
<file>thread.c</file>
<file>tls.c</file>
</directory>
+</module>
+<module name="kernel32" type="win32dll" baseaddress="${BASEADDRESS_KERNEL32}">
+ <importlibrary definition="kernel32.def" />
+ <include base="kernel32">.</include>
+ <include base="kernel32">include</include>
+ <define name="_DISABLE_TIDENTS" />
+ <define name="_SEH_NO_NATIVE_NLG" />
+ <define name="WINVER">0x0500</define>
+ <library>kernel32_base</library>
+ <library>pseh</library>
+ <library>rosrtl</library>
+ <library>ntdll</library>
+ <linkerflag>-lgcc</linkerflag>
+ <linkerflag>-nostartfiles</linkerflag>
+ <linkerflag>-nostdlib</linkerflag>
<file>kernel32.rc</file>
-
</module>
+<!--
+<directory name="tests">
+ <xi:include href="tests/kernel32.xml" />
+</directory>
+-->
--- branches/xmlbuildsystem/reactos/lib/kernel32/tests/kernel32.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/lib/kernel32/tests/kernel32.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -0,0 +1,19 @@
+<module name="kernel32_test" type="test">
+ <include base="rtshared">.</include>
+ <define name="_DISABLE_TIDENTS" />
+ <define name="_SEH_NO_NATIVE_NLG" />
+ <define name="WINVER">0x0500</define>
+ <library>kernel32_base</library>
+ <library>pseh</library>
+ <library>rosrtl</library>
+ <library>ntdll</library>
+ <library>rtshared</library>
+ <linkerflag>-lgcc</linkerflag>
+ <linkerflag>-nostartfiles</linkerflag>
+ <linkerflag>-nostdlib</linkerflag>
+ <directory name="tests">
+ <file>CreateFile.c</file>
+ </directory>
+ <file>setup.c</file>
+ <xi:include href="stubs.xml" />
+</module>
--- branches/xmlbuildsystem/reactos/lib/kernel32/tests/stubs.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/lib/kernel32/tests/stubs.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -0,0 +1,136 @@
+<component name="ntdll.dll">
+ <symbol>CsrCaptureParameterBuffer@16</symbol>
+ <symbol>CsrClientCallServer@16</symbol>
+ <symbol>CsrClientConnectToServer@0</symbol>
+ <symbol>CsrReleaseParameterBuffer@4</symbol>
+ <symbol>DbgUiContinue@8</symbol>
+ <symbol newname="RtlAllocateHeap">HeapAlloc@12</symbol>
+ <symbol newname="RtlFreeHeap">HeapFree@12</symbol>
+ <symbol>LdrAccessResource@16</symbol>
+ <symbol>LdrDisableThreadCalloutsForDll@4</symbol>
+ <symbol>LdrDisableThreadCalloutsForDll@4</symbol>
+ <symbol>LdrFindResource_U@16</symbol>
+ <symbol>LdrLoadDll@16</symbol>
+ <symbol>LdrShutdownProcess@0</symbol>
+ <symbol>LdrShutdownThread@0</symbol>
+ <symbol>LdrUnloadDll@4</symbol>
+ <symbol>NtAllocateVirtualMemory@24</symbol>
+ <symbol>NtClose@4</symbol>
+ <symbol>NtCreateDirectoryObject@12</symbol>
+ <symbol>NtCreateEvent@20</symbol>
+ <symbol>NtCreateFile@44</symbol>
+ <symbol>NtCreateKey@28</symbol>
+ <symbol>NtCreateProcess@32</symbol>
+ <symbol>NtCreateSection@28</symbol>
+ <symbol>NtDelayExecution@8</symbol>
+ <symbol>NtDeviceIoControlFile@40</symbol>
+ <symbol>_imp__NtDuplicateObject@28</symbol>
+ <symbol>NtFlushBuffersFile@8</symbol>
+ <symbol>NtFlushInstructionCache@12</symbol>
+ <symbol>NtFlushVirtualMemory@16</symbol>
+ <symbol>NtFreeVirtualMemory@16</symbol>
+ <symbol>NtFsControlFile@40</symbol>
+ <symbol>NtGetContextThread@8</symbol>
+ <symbol>NtLockVirtualMemory@16</symbol>
+ <symbol>NtOpenDirectoryObject@12</symbol>
+ <symbol>NtOpenEvent@12</symbol>
+ <symbol>NtOpenFile@24</symbol>
+ <symbol>NtOpenKey@12</symbol>
+ <symbol>NtOpenProcess@16</symbol>
+ <symbol>NtOpenSection@12</symbol>
+ <symbol>NtOpenThread@16</symbol>
+ <symbol>NtProtectVirtualMemory@20</symbol>
+ <symbol>NtPulseEvent@8</symbol>
+ <symbol>NtQueryDefaultLocale@8</symbol>
+ <symbol>NtQueryDefaultUILanguage@4</symbol>
+ <symbol>NtQueryDirectoryFile@44</symbol>
+ <symbol>NtQueryInformationFile@20</symbol>
+ <symbol>_imp__NtQueryInformationProcess@20</symbol>
+ <symbol>NtQueryInformationThread@20</symbol>
+ <symbol>NtQueryObject@20</symbol>
+ <symbol>NtQuerySystemInformation@16</symbol>
+ <symbol>NtQuerySystemTime@4</symbol>
+ <symbol>NtQueryValueKey@24</symbol>
+ <symbol>NtQueryVirtualMemory@24</symbol>
+ <symbol>NtQueryVolumeInformationFile@20</symbol>
+ <symbol>NtReadFile@36</symbol>
+ <symbol>NtReadVirtualMemory@20</symbol>
+ <symbol>NtResetEvent@8</symbol>
+ <symbol>NtResumeThread@8</symbol>
+ <symbol>NtSetContextThread@8</symbol>
+ <symbol>NtSetEvent@8</symbol>
+ <symbol>NtSetInformationFile@20</symbol>
+ <symbol>NtSetInformationObject@16</symbol>
+ <symbol>_imp__NtSetInformationProcess@16</symbol>
+ <symbol>NtSetInformationThread@16</symbol>
+ <symbol>NtSetSystemInformation@12</symbol>
+ <symbol>NtSetSystemTime@8</symbol>
+ <symbol>NtSignalAndWaitForSingleObject@16</symbol>
+ <symbol>NtSuspendThread@8</symbol>
+ <symbol>NtTerminateThread@8</symbol>
+ <symbol>NtUnlockVirtualMemory@16</symbol>
+ <symbol>NtUnmapViewOfSection@8</symbol>
+ <symbol>NtWaitForMultipleObjects@20</symbol>
+ <symbol>NtWaitForSingleObject@12</symbol>
+ <symbol>NtWriteFile@36</symbol>
+ <symbol>NtWriteVirtualMemory@20</symbol>
+ <symbol>NtYieldExecution@0</symbol>
+ <symbol>RtlAcquirePebLock@0</symbol>
+ <symbol>RtlAnsiStringToUnicodeSize@4</symbol>
+ <symbol>_imp__RtlBaseProcessStartRoutine</symbol>
+ <symbol>RtlCompactHeap@8</symbol>
+ <symbol>RtlCopyUnicodeString@8</symbol>
+ <symbol>RtlCreateHeap@24</symbol>
+ <symbol>RtlCreateProcessParameters@40</symbol>
+ <symbol>RtlCreateUnicodeString@8</symbol>
+ <symbol>RtlCreateUnicodeStringFromAsciiz@8</symbol>
+ <symbol>RtlDeleteCriticalSection@4</symbol>
+ <symbol>RtlDestroyHeap@4</symbol>
+ <symbol>RtlDestroyProcessParameters@4</symbol>
+ <symbol>RtlDoesFileExists_U@4</symbol>
+ <symbol>RtlDosPathNameToNtPathName_U@16</symbol>
+ <symbol>RtlDosSearchPath_U@24</symbol>
+ <symbol>RtlEnterCriticalSection@4</symbol>
+ <symbol>RtlExpandEnvironmentStrings_U@16</symbol>
+ <symbol>RtlFreeHeap@12</symbol>
+ <symbol>RtlGetCurrentDirectory_U@8</symbol>
+ <symbol>RtlGetFullPathName_U@16</symbol>
+ <symbol>RtlGetProcessHeaps@8</symbol>
+ <symbol>RtlImageNtHeader@4</symbol>
+ <symbol>RtlInitCodePageTable@8</symbol>
+ <symbol>RtlInitializeCriticalSection@4</symbol>
+ <symbol>RtlInitUnicodeString@8</symbol>
+ <symbol>RtlIntegerToChar@16</symbol>
+ <symbol>RtlIntegerToUnicodeString@12</symbol>
+ <symbol>RtlIsNameLegalDOS8Dot3@12</symbol>
+ <symbol>RtlLeaveCriticalSection@4</symbol>
+ <symbol>RtlLockHeap@4</symbol>
+ <symbol>RtlNtStatusToDosError@4</symbol>
+ <symbol>RtlOemStringToUnicodeSize@4</symbol>
+ <symbol>RtlOemStringToUnicodeString@12</symbol>
+ <symbol>RtlOpenCurrentUser@8</symbol>
+ <symbol>RtlQueryEnvironmentVariable_U@12</symbol>
+ <symbol>RtlRaiseException@4</symbol>
+ <symbol>RtlReAllocateHeap@16</symbol>
+ <symbol>RtlReleasePebLock@0</symbol>
+ <symbol>RtlRosCreateUserThreadVa</symbol>
+ <symbol>RtlRosExitUserThread@4</symbol>
+ <symbol>RtlSetCurrentDirectory_U@4</symbol>
+ <symbol>RtlSetEnvironmentVariable@12</symbol>
+ <symbol>RtlSetTimeZoneInformation@4</symbol>
+ <symbol>RtlTimeFieldsToTime@8</symbol>
+ <symbol>RtlTimeToTimeFields@8</symbol>
+ <symbol>RtlUnicodeStringToAnsiSize@4</symbol>
+ <symbol>RtlUnicodeStringToAnsiString@12</symbol>
+ <symbol>RtlUnicodeStringToInteger@12</symbol>
+ <symbol>RtlUnicodeStringToOemString@12</symbol>
+ <symbol>RtlUnicodeToOemN@20</symbol>
+ <symbol>RtlUnlockHeap@4</symbol>
+ <symbol>RtlValidateHeap@12</symbol>
+ <symbol>ZwMapViewOfSection@40</symbol>
+ <symbol>ZwOpenSection@12</symbol>
+ <symbol>ZwQuerySection@20</symbol>
+ <symbol>ZwQuerySystemInformation@16</symbol>
+ <symbol>ZwReadFile@36</symbol>
+ <symbol>ZwTerminateProcess@8</symbol>
+</component>
--- branches/xmlbuildsystem/reactos/regtests/directory.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/regtests/directory.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -0,0 +1,6 @@
+<directory name="regtests">
+ <xi:include href="regtests/regtests.xml" />
+</directory>
+<directory name="shared">
+ <xi:include href="shared/rtshared.xml" />
+</directory>
--- branches/xmlbuildsystem/reactos/regtests/regtests/regtests.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/regtests/regtests/regtests.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -0,0 +1,6 @@
+<module name="regtests" type="win32dll" baseaddress="${BASEADDRESS_REGTESTS}">
+ <importlibrary definition="regtests.def" />
+ <include base="regtests">.</include>
+ <library>kernel32</library>
+ <file>regtests.c</file>
+</module>
--- branches/xmlbuildsystem/reactos/regtests/shared/rtshared.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/regtests/shared/rtshared.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -0,0 +1,4 @@
+<module name="rtshared" type="staticlibrary">
+ <include base="rtshared">.</include>
+ <file>regtests.c</file>
+</module>
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -176,6 +176,7 @@
fprintf ( fMakefile, "bin2res = " TOOL_PREFIX "bin2res" SSEP "bin2res" EXEPOSTFIX "\n" );
fprintf ( fMakefile, "cabman = " TOOL_PREFIX "cabman" SSEP "cabman" EXEPOSTFIX "\n" );
fprintf ( fMakefile, "cdmake = " TOOL_PREFIX "cdmake" SSEP "cdmake" EXEPOSTFIX "\n" );
+ fprintf ( fMakefile, "regtests = " TOOL_PREFIX "regtests" EXEPOSTFIX "\n" );
fprintf ( fMakefile, "rsym = " TOOL_PREFIX "rsym" EXEPOSTFIX "\n" );
fprintf ( fMakefile, "wrc = " TOOL_PREFIX "wrc" SSEP "wrc" EXEPOSTFIX "\n" );
fprintf ( fMakefile, "\n" );
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -152,6 +152,9 @@
case Iso:
handler = new MingwIsoModuleHandler ( backend );
break;
+ case Test:
+ handler = new MingwTestModuleHandler ( backend );
+ break;
}
return handler;
}
@@ -1226,10 +1229,10 @@
clean_files );
CLEAN_FILE ( ar_target );
- string tgt = FixupTargetFilename(module.GetPath());
- if ( tgt != ar_target )
+ string target = FixupTargetFilename ( module.GetPath () );
+ if ( target != ar_target )
{
- CLEAN_FILE ( tgt );
+ CLEAN_FILE ( target );
}
}
@@ -1882,8 +1885,7 @@
{
GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );
- string dependencies =
- objectsMacro + " " + linkDepsMacro;
+ string dependencies = objectsMacro + " " + linkDepsMacro;
string linker;
if ( module.cplusplus )
@@ -2302,3 +2304,63 @@
fprintf ( fMakefile,
"\n" );
}
+
+
+MingwTestModuleHandler::MingwTestModuleHandler ( MingwBackend* backend )
+ : MingwModuleHandler ( Test,
+ backend )
+{
+}
+
+void
+MingwTestModuleHandler::Process ( const Module& module, string_list& clean_files )
+{
+ GeneratePreconditionDependencies ( module );
+ GenerateTestModuleTarget ( module, clean_files );
+ GenerateInvocations ( module );
+}
+
+void
+MingwTestModuleHandler::GenerateTestModuleTarget ( const Module& module, string_list& clean_files )
+{
+ static string ros_junk ( "$(ROS_TEMPORARY)" );
+ string target ( FixupTargetFilename ( module.GetPath () ) );
+ string workingDirectory = GetWorkingDirectory ( );
+ string objectsMacro = GetObjectsMacro ( module );
+ string linkDepsMacro = GetLinkingDependenciesMacro ( module );
+ string libsMacro = GetLibsMacro ( module );
+
+ GenerateImportLibraryTargetIfNeeded ( module, clean_files );
+
+ if ( module.non_if_data.files.size () > 0 )
+ {
+ GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );
+
+ string dependencies = objectsMacro + " " + linkDepsMacro;
+
+ string linker;
+ if ( module.cplusplus )
+ linker = "${gpp}";
+ else
+ linker = "${gcc}";
+
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
+ module.entrypoint.c_str (),
+ module.baseaddress.c_str () );
+ GenerateLinkerCommand ( module,
+ target,
+ dependencies,
+ linker,
+ linkerParameters,
+ objectsMacro,
+ libsMacro,
+ clean_files );
+ }
+ else
+ {
+ fprintf ( fMakefile, ".PHONY: %s\n\n",
+ target.c_str ());
+ fprintf ( fMakefile, "%s:\n\n",
+ target.c_str ());
+ }
+}
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-03-20 21:58:30 UTC (rev 14241)
@@ -336,4 +336,14 @@
const Module& module );
};
+class MingwTestModuleHandler : public MingwModuleHandler
+{
+public:
+ MingwTestModuleHandler ( MingwBackend* backend );
+ virtual HostType DefaultHost() { return HostFalse; }
+ virtual void Process ( const Module& module, string_list& clean_files );
+private:
+ void GenerateTestModuleTarget ( const Module& module, string_list& clean_files );
+};
+
#endif /* MINGW_MODULEHANDLER_H */
--- branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -39,6 +39,7 @@
case StaticLibrary:
case ObjectLibrary:
case Iso:
+ case Test:
return false;
}
throw InvalidOperationException ( __FILE__,
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -197,6 +197,8 @@
delete compilerFlags[i];
for ( i = 0; i < linkerFlags.size(); i++ )
delete linkerFlags[i];
+ for ( i = 0; i < stubbedComponents.size(); i++ )
+ delete stubbedComponents[i];
if ( pch )
delete pch;
}
@@ -215,6 +217,8 @@
compilerFlags[i]->ProcessXML();
for ( i = 0; i < linkerFlags.size(); i++ )
linkerFlags[i]->ProcessXML();
+ for ( i = 0; i < stubbedComponents.size(); i++ )
+ stubbedComponents[i]->ProcessXML();
non_if_data.ProcessXML();
if ( pch )
pch->ProcessXML();
@@ -342,6 +346,11 @@
linkerFlags.push_back ( new LinkerFlag ( project, this, e ) );
subs_invalid = true;
}
+ else if ( e.name == "component" )
+ {
+ stubbedComponents.push_back ( new StubbedComponent ( this, e ) );
+ subs_invalid = false;
+ }
else if ( e.name == "property" )
{
throw InvalidBuildFileException (
@@ -407,6 +416,8 @@
return BootSector;
if ( attribute.value == "iso" )
return Iso;
+ if ( attribute.value == "test" )
+ return Test;
throw InvalidAttributeValueException ( location,
attribute.name,
attribute.value );
@@ -439,6 +450,8 @@
return ".o";
case Iso:
return ".iso";
+ case Test:
+ return ".exe";
}
throw InvalidOperationException ( __FILE__,
__LINE__ );
@@ -460,6 +473,7 @@
case Win32DLL:
return "_DllMain@12";
case Win32CUI:
+ case Test:
return "_mainCRTStartup";
case Win32GUI:
return "_WinMainCRTStartup";
@@ -493,6 +507,7 @@
case Win32DLL:
return "0x10000";
case Win32CUI:
+ case Test:
return "0x00400000";
case Win32GUI:
return "0x00400000";
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-03-20 21:58:30 UTC (rev 14241)
@@ -57,6 +57,8 @@
class Bootstrap;
class CDFile;
class PchFile;
+class StubbedComponent;
+class StubbedSymbol;
class SourceFileTest;
@@ -130,7 +132,8 @@
Win32GUI,
BootLoader,
BootSector,
- Iso
+ Iso,
+ Test
};
enum HostType
@@ -159,6 +162,7 @@
std::vector<Dependency*> dependencies;
std::vector<CompilerFlag*> compilerFlags;
std::vector<LinkerFlag*> linkerFlags;
+ std::vector<StubbedComponent*> stubbedComponents;
PchFile* pch;
bool cplusplus;
std::string prefix;
@@ -526,6 +530,35 @@
void ProcessXML();
};
+
+class StubbedComponent
+{
+public:
+ const Module* module;
+ const XMLElement& node;
+ std::string name;
+ std::vector<StubbedSymbol*> symbols;
+
+ StubbedComponent ( const Module* module_,
+ const XMLElement& stubbedComponentNode );
+ ~StubbedComponent ();
+ void ProcessXML ();
+ void ProcessXMLSubElement ( const XMLElement& e );
+};
+
+
+class StubbedSymbol
+{
+public:
+ const XMLElement& node;
+ std::string symbol;
+ std::string newname;
+
+ StubbedSymbol ( const XMLElement& stubbedSymbolNode );
+ ~StubbedSymbol ();
+ void ProcessXML();
+};
+
extern std::string
FixSeparator ( const std::string& s );
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.mak 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.mak 2005-03-20 21:58:30 UTC (rev 14241)
@@ -39,6 +39,7 @@
module.cpp \
project.cpp \
ssprintf.cpp \
+ stubbedcomponent.cpp \
XML.cpp
RBUILD_COMMON_SOURCES = \
@@ -62,6 +63,7 @@
$(RBUILD_SPECIAL_OBJECTS)
RBUILD_TESTS = \
+ tests$(SEP)cdfiletest.cpp \
tests$(SEP)definetest.cpp \
tests$(SEP)functiontest.cpp \
tests$(SEP)iftest.cpp \
@@ -71,7 +73,7 @@
tests$(SEP)moduletest.cpp \
tests$(SEP)projecttest.cpp \
tests$(SEP)sourcefiletest.cpp \
- tests$(SEP)cdfiletest.cpp
+ tests$(SEP)symboltest.cpp
RBUILD_TEST_SPECIAL_SOURCES = \
$(addprefix $(RBUILD_BASE)$(SEP), $(RBUILD_TESTS)) \
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt 2005-03-20 21:58:30 UTC (rev 14241)
@@ -123,7 +123,7 @@
None.
Elements:
- bootstrap, define, dependency, directory, file, if, importlibrary, include, invoke, library, property.
+ bootstrap, component, define, dependency, directory, file, if, importlibrary, include, invoke, library, property.
Module types
@@ -137,10 +137,12 @@
kernelmodedriver - Builds a kernel-mode driver. Default extension is .sys. Default entrypoint is _DriverEntry@8.
nativedll - Builds a native DLL. Default extension is .dll. Default entrypoint is _DllMainCRTStartup@12.
win32dll - Builds a Win32 DLL. Default extension is .dll. Default entrypoint is _DllMain@12.
+ win32cui - Builds a Win32 console executable. Default extension is .exe. Default entrypoint is _mainCRTStartup. The baseaddress module attribute is not applicable for this module type.
win32gui - Builds a Win32 GUI executable. Default extension is .exe. Default entrypoint is _WinMainCRTStartup. The baseaddress module attribute is not applicable for this module type.
bootloader - Builds a bootloader. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
bootsector - Builds one or more bootsector binaries. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
iso - Builds a bootable CD. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
+ test - Builds a testsuite. Default extension is .exe. Default entrypoint is _mainCRTStartup. The baseaddress module attribute is not applicable for this module type.
Bootstrap element
@@ -179,6 +181,42 @@
None.
+Component element
+-----------------
+A component element specifies that imports from a library are to be stubbed so tests can be run without actually calling the functions in the library. This element can only be used for modules of type test.
+
+Syntax:
+ <component name="ntdll.dll">
+ ...
+ </component>
+
+Attributes:
+ name - Name of library.
+
+Value:
+ None.
+
+Elements:
+ Symbol.
+
+
+Symbol element
+--------------
+A symbol element specifies an imported function from a library that is to be stubbed so tests can be run without actually calling the function in the library.
+
+Syntax:
+ <symbol newname="RtlAllocateHeap">HeapAlloc@12</symbol>
+
+Attributes:
+ newname - New name of symbol. This attribute is optional.
+
+Value:
+ Name of symbol.
+
+Elements:
+ None.
+
+
Define element
--------------
A define element specifies the name and (optionally) value of a define for the C/C++ compiler and resource compiler.
--- branches/xmlbuildsystem/reactos/tools/rbuild/stubbedcomponent.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/stubbedcomponent.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -0,0 +1,80 @@
+#include "pch.h"
+#include <assert.h>
+
+#include "rbuild.h"
+
+using std::string;
+using std::vector;
+
+StubbedComponent::StubbedComponent ( const Module* module_,
+ const XMLElement& stubbedComponentNode )
+ : module(module_),
+ node(stubbedComponentNode)
+{
+ const XMLAttribute* att = node.GetAttribute ( "name", true );
+ assert ( att );
+ name = att->value;
+}
+
+StubbedComponent::~StubbedComponent ()
+{
+ for ( size_t i = 0; i < symbols.size(); i++ )
+ delete symbols[i];
+}
+
+void
+StubbedComponent::ProcessXML ()
+{
+ size_t i;
+ for ( i = 0; i < node.subElements.size (); i++ )
+ ProcessXMLSubElement ( *node.subElements[i] );
+ for ( i = 0; i < symbols.size (); i++ )
+ symbols[i]->ProcessXML ();
+}
+
+void
+StubbedComponent::ProcessXMLSubElement ( const XMLElement& e )
+{
+ bool subs_invalid = false;
+ if ( e.name == "symbol" )
+ {
+ symbols.push_back ( new StubbedSymbol ( e ) );
+ subs_invalid = false;
+ }
+ if ( subs_invalid && e.subElements.size () > 0 )
+ throw InvalidBuildFileException (
+ e.location,
+ "<%s> cannot have sub-elements",
+ e.name.c_str() );
+ for ( size_t i = 0; i < e.subElements.size (); i++ )
+ ProcessXMLSubElement ( *e.subElements[i] );
+}
+
+
+
+StubbedSymbol::StubbedSymbol ( const XMLElement& stubbedSymbolNode )
+ : node(stubbedSymbolNode)
+{
+}
+
+StubbedSymbol::~StubbedSymbol ()
+{
+}
+
+void
+StubbedSymbol::ProcessXML ()
+{
+ if ( node.value.size () == 0 )
+ {
+ throw InvalidBuildFileException (
+ node.location,
+ "<symbol> is empty." );
+ }
+ symbol = node.value;
+
+ const XMLAttribute* att = node.GetAttribute ( "newname", false );
+ if ( att != NULL )
+ newname = att->value;
+ else
+ newname = symbol;
+}
--- branches/xmlbuildsystem/reactos/tools/rbuild/test.h 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/test.h 2005-03-20 21:58:30 UTC (rev 14241)
@@ -126,4 +126,11 @@
void Run ();
};
+
+class SymbolTest : public BaseTest
+{
+public:
+ void Run ();
+};
+
#endif /* __TEST_H */
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -179,6 +179,7 @@
tests.push_back(new FunctionTest());
tests.push_back(new SourceFileTest());
tests.push_back(new CDFileTest());
+ tests.push_back(new SymbolTest());
}
};
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/symbol.xml 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/symbol.xml 2005-03-20 21:58:30 UTC (rev 14241)
@@ -0,0 +1,9 @@
+<?xml version="1.0" ?>
+<project name="Project" makefile="Makefile">
+ <module name="module1" type="test">
+ <component name="ntdll.dll">
+ <symbol newname="RtlAllocateHeap">HeapAlloc@12</symbol>
+ <symbol>LdrAccessResource@16</symbol>
+ </component>
+ </module>
+</project>
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/functiontest.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/functiontest.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -5,5 +5,5 @@
void FunctionTest::Run ()
{
string fixedupFilename = FixupTargetFilename ( "." SSEP "dir1" SSEP "dir2" SSEP ".." SSEP "filename.txt" );
- ARE_EQUAL ( "$(ROS_INTERMEDIATE)." SSEP "dir1" SSEP "filename.txt", fixedupFilename );
+ ARE_EQUAL ( "$(INTERMEDIATE)dir1" SSEP "filename.txt", fixedupFilename );
}
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -17,9 +17,9 @@
ARE_EQUAL ( 1, if1.data.files.size () );
File& file1 = *if1.data.files[0];
- ARE_EQUAL( "." SSEP "file1.c", file1.name );
+ ARE_EQUAL( SSEP "file1.c", file1.name );
ARE_EQUAL ( 1, module1.non_if_data.files.size () );
File& file2 = *module1.non_if_data.files[0];
- ARE_EQUAL( "." SSEP "file2.c", file2.name );
+ ARE_EQUAL( SSEP "file2.c", file2.name );
}
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -20,5 +20,5 @@
ARE_EQUAL(1, module2.non_if_data.includes.size());
Include& include3 = *module2.non_if_data.includes[0];
- ARE_EQUAL(FixSeparator("./dir1/include3"), include3.directory);
+ ARE_EQUAL(FixSeparator("dir1/include3"), include3.directory);
}
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/invoketest.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/invoketest.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -15,5 +15,5 @@
ARE_EQUAL(1, invoke1.output.size());
InvokeFile& file1 = *invoke1.output[0];
- ARE_EQUAL(FixSeparator("./dir1/file1.c"), file1.name);
+ ARE_EQUAL(FixSeparator("dir1/file1.c"), file1.name);
}
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -11,16 +11,16 @@
Module& module1 = *project.modules[0];
IS_TRUE(module1.type == BuildTool);
ARE_EQUAL(2, module1.non_if_data.files.size());
- ARE_EQUAL("." SSEP "dir1" SSEP "file1.c", module1.non_if_data.files[0]->name);
- ARE_EQUAL("." SSEP "dir1" SSEP "file2.c", module1.non_if_data.files[1]->name);
+ ARE_EQUAL("dir1" SSEP "file1.c", module1.non_if_data.files[0]->name);
+ ARE_EQUAL("dir1" SSEP "file2.c", module1.non_if_data.files[1]->name);
ARE_EQUAL(0, module1.non_if_data.libraries.size());
Module& module2 = *project.modules[1];
IS_TRUE(module2.type == KernelModeDLL);
ARE_EQUAL(2, module2.non_if_data.files.size());
- ARE_EQUAL("." SSEP "dir2" SSEP "file3.c", module2.non_if_data.files[0]->name);
- ARE_EQUAL("." SSEP "dir2" SSEP "file4.c", module2.non_if_data.files[1]->name);
+ ARE_EQUAL("dir2" SSEP "file3.c", module2.non_if_data.files[0]->name);
+ ARE_EQUAL("dir2" SSEP "file4.c", module2.non_if_data.files[1]->name);
ARE_EQUAL(1, module2.non_if_data.libraries.size());
Library& library1 = *module2.non_if_data.libraries[0];
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/sourcefiletest.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/sourcefiletest.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -38,9 +38,9 @@
AutomaticDependency automaticDependency ( project );
automaticDependency.Process ();
ARE_EQUAL( 4, automaticDependency.sourcefile_map.size () );
- const SourceFile* include = automaticDependency.RetrieveFromCache ( "." SSEP RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile_include.h" );
+ const SourceFile* include = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile_include.h" );
IS_NOT_NULL( include );
- const SourceFile* includenext = automaticDependency.RetrieveFromCache ( "." SSEP RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1" SSEP "sourcefile_includenext.h" );
+ const SourceFile* includenext = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1" SSEP "sourcefile_includenext.h" );
IS_NOT_NULL( includenext );
}
@@ -51,9 +51,9 @@
AutomaticDependency automaticDependency ( project );
automaticDependency.Process ();
ARE_EQUAL( 5, automaticDependency.sourcefile_map.size () );
- const SourceFile* header1 = automaticDependency.RetrieveFromCache ( "." SSEP RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1_header1.h" );
+ const SourceFile* header1 = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1_header1.h" );
IS_NOT_NULL( header1 );
- const SourceFile* recurse = automaticDependency.RetrieveFromCache ( "." SSEP RBUILD_BASE"tests" SSEP "data" SSEP "sourcefile1_recurse.h" );
+ const SourceFile* recurse = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1_recurse.h" );
IS_NOT_NULL( recurse );
IS_TRUE( IsParentOf ( header1,
recurse ) );
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/symboltest.cpp 2005-03-20 21:57:01 UTC (rev 14240)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/symboltest.cpp 2005-03-20 21:58:30 UTC (rev 14241)
@@ -0,0 +1,25 @@
+#include "test.h"
+
+using std::string;
+
+void SymbolTest::Run()
+{
+ string projectFilename ( RBUILD_BASE "tests/data/symbol.xml" );
+ Project project ( projectFilename );
+
+ ARE_EQUAL ( 1, project.modules.size () );
+ Module& module1 = *project.modules[0];
+
+ ARE_EQUAL ( 1, module1.stubbedComponents.size () );
+ StubbedComponent& component1 = *module1.stubbedComponents[0];
+ ARE_EQUAL ( "ntdll.dll", component1.name );
+
+ ARE_EQUAL ( 2, component1.symbols.size () );
+ StubbedSymbol& symbol1 = *component1.symbols[0];
+ ARE_EQUAL ( "HeapAlloc@12", symbol1.symbol );
+ ARE_EQUAL ( "RtlAllocateHeap", symbol1.newname );
+
+ StubbedSymbol& symbol2 = *component1.symbols[1];
+ ARE_EQUAL ( "LdrAccessResource@16", symbol2.symbol );
+ ARE_EQUAL ( "LdrAccessResource@16", symbol2.newname );
[truncated at 1000 lines; 1 more skipped]