diff --git a/build/jam/DefaultBuildProfiles b/build/jam/DefaultBuildProfiles index 25b19ca888..48b2304b69 100644 --- a/build/jam/DefaultBuildProfiles +++ b/build/jam/DefaultBuildProfiles @@ -20,6 +20,14 @@ switch $(HAIKU_BUILD_PROFILE) { TARGET_DEFINES += HAIKU_MINIMUM_BUILD ; } + case "test-*" : { + HAIKU_BUILD_TYPE = test ; + EnableBuildFeatures minimum_image ; + + HAIKU_DEFINES += HAIKU_MINIMUM_BUILD ; + TARGET_DEFINES += HAIKU_MINIMUM_BUILD ; + } + case "*" : { HAIKU_BUILD_TYPE = regular ; EnableBuildFeatures regular_image ; @@ -64,6 +72,9 @@ rule DefineDefaultBuildProfiles DefineBuildProfile minimum-anyboot : anyboot-image : "haiku-minimum-anyboot.iso" ; + # test profiles + DefineBuildProfile test-raw : image : "haiku-test.image" ; + switch $(HAIKU_BUILD_PROFILE) { case "release-*" : { Echo Building Haiku R1/development preview ; @@ -176,6 +187,18 @@ rule DefineDefaultBuildProfiles ; } + case "test-*" : { + Echo Building Haiku UnitTest Target ; + HAIKU_IMAGE_HOST_NAME ?= shredder ; + if $(DEBUG) != 0 { + HAIKU_IMAGE_SIZE ?= 450 ; + } + + AddHaikuImageSystemPackages + openssl3 + ; + } + case "bootstrap-*" : { Echo Building Haiku Bootstrap ; HAIKU_IMAGE_HOST_NAME ?= shredder ; diff --git a/build/jam/HaikuPackages b/build/jam/HaikuPackages index fe23c62f79..904ff108f0 100644 --- a/build/jam/HaikuPackages +++ b/build/jam/HaikuPackages @@ -18,6 +18,10 @@ if $(HAIKU_BUILD_TYPE) = bootstrap { packages += Haiku ; } +if $(HAIKU_BUILD_TYPE) = test { + packages += HaikuUnitTests ; +} + local archDependentPackages = HaikuCrossDevel WebPositive diff --git a/build/jam/images/HaikuImage b/build/jam/images/HaikuImage index 46cea5ea4a..77ae4e800d 100644 --- a/build/jam/images/HaikuImage +++ b/build/jam/images/HaikuImage @@ -7,6 +7,8 @@ if $(HAIKU_BUILD_TYPE) = bootstrap { include [ FDirName $(HAIKU_BUILD_RULES_DIR) images definitions bootstrap ] ; } else if $(HAIKU_BUILD_TYPE) = minimum { include [ FDirName $(HAIKU_BUILD_RULES_DIR) images definitions minimum ] ; +} else if $(HAIKU_BUILD_TYPE) = test { + include [ FDirName $(HAIKU_BUILD_RULES_DIR) images definitions minimum ] ; } else { include [ FDirName $(HAIKU_BUILD_RULES_DIR) images definitions regular ] ; } @@ -23,5 +25,9 @@ AddPackageFilesToHaikuImage system packages : nameFromMetaInfo ; +if $(HAIKU_BUILD_TYPE) = test { + AddPackageFilesToHaikuImage system packages : haiku_unittests.hpkg ; +} + # import what is shared by all images include [ FDirName $(HAIKU_BUILD_RULES_DIR) images definitions common-tail ] ; diff --git a/build/jam/packages/HaikuUnitTests b/build/jam/packages/HaikuUnitTests new file mode 100644 index 0000000000..6a01a136c0 --- /dev/null +++ b/build/jam/packages/HaikuUnitTests @@ -0,0 +1,9 @@ +local haikuUnitTestsPackage = haiku_unittests.hpkg ; +HaikuPackage $(haikuUnitTestsPackage) ; + +CopyDirectoryToPackage add-ons + : + $(TARGET_UNIT_TEST_DIR) +; + +BuildHaikuPackage $(haikuUnitTestsPackage) : haiku_unittests ; diff --git a/build/jam/repositories/Haiku b/build/jam/repositories/Haiku index b1a7d82552..97a81b098b 100644 --- a/build/jam/repositories/Haiku +++ b/build/jam/repositories/Haiku @@ -30,6 +30,10 @@ if $(HAIKU_IS_BOOTSTRAP) != 1 && $(HAIKU_BUILD_TYPE) != minimum { } } +if $(HAIKU_BUILD_TYPE) = test { + packages += haiku_unittests ; +} + local webPositiveIsAvailable ; local architectureObject ; for architectureObject in [ MultiArchSubDirSetup ] { diff --git a/src/data/package_infos/generic/haiku_unittests b/src/data/package_infos/generic/haiku_unittests new file mode 100644 index 0000000000..f7cc3f825c --- /dev/null +++ b/src/data/package_infos/generic/haiku_unittests @@ -0,0 +1,19 @@ +name haiku_unittests +version %HAIKU_VERSION% +architecture %HAIKU_PACKAGING_ARCH% +summary "Haiku unit tests" +description "Unit tests to ensure the continued stability of Haiku" + +packager "The Haiku build system" +vendor "Haiku Project" + +copyrights "2007-2026 Haiku, Inc." +licenses MIT + +provides { + haiku_unittests=%HAIKU_VERSION% +} + +requires { + haiku +} diff --git a/src/tests/kits/storage/Jamfile b/src/tests/kits/storage/Jamfile index 59a146f5e6..af33ce2b07 100644 --- a/src/tests/kits/storage/Jamfile +++ b/src/tests/kits/storage/Jamfile @@ -28,12 +28,28 @@ UnitTestLib libstoragetest.so : be [ TargetLibstdc++ ] ; +rule CopyResources { + local files = $(1) ; + local sourceDir = $(2) ; + local targetDir = $(3) ; + for file in $(files) { + LOCATE on $(file) = $(sourceDir) ; + local targetFile = $(file:G=tests!unittests) ; + MakeLocate $(targetFile) : [ FDirName $(TARGET_UNIT_TEST_DIR) $(targetDir) ] ; + File $(targetFile) : $(file) ; + MODE on $(targetFile) = $(EXEMODE) ; + MimeSet $(targetFile) ; + } +} + # To run the tests some test files must be around. { - local resdir = resources ; - MakeLocate $(resdir) : $(TARGET_UNIT_TEST_DIR) ; - RelSymLink $(resdir) : [ FDirName $(HAIKU_TOP) src tests kits storage resources ] : false ; - Depends libstoragetest.so : $(resdir) ; + local sourceDir = src tests kits storage resources ; + local files = elf elf-no-res pef pef-no-res ppc.rsrc x86.rsrc ; + local sourceDirName = [ FDirName $(HAIKU_TOP) $(sourceDir) ] ; + local grist = [ FGrist $(sourceDir) ] ; + CopyResources $(files:G=$(grist)) : $(sourceDirName) : resources ; + Depends libstoragetest.so : $(files:G=tests!unittests) ; } SubInclude HAIKU_TOP src tests kits storage disk_device ; diff --git a/src/tools/cppunit/Jamfile b/src/tools/cppunit/Jamfile index 7a7d0ed91d..ecff76f5a9 100644 --- a/src/tools/cppunit/Jamfile +++ b/src/tools/cppunit/Jamfile @@ -15,6 +15,8 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) cppunit ] ; } } +MakeLocate libcppunit.so : $(TARGET_UNIT_TEST_LIB_DIR) ; + SharedLibrary libcppunit.so : BTestCase.cpp BTestSuite.cpp @@ -54,11 +56,3 @@ SharedLibrary libcppunit.so : if ( $(OS) = BEOS || $(OS) = HAIKU ) && $(OSPLAT) != PPC { LinkAgainst libcppunit.so : libelfsymbolpatcher.a debug ; } - -# To run the tests we need the cppunit library. -{ - local target = libcppunit.so ; - MakeLocate $(target) : $(TARGET_UNIT_TEST_LIB_DIR) ; - RelSymLink $(target) : libcppunit.so ; - Depends libcppunit.so : $(target) ; -} diff --git a/src/tools/cppunit/TestShell.cpp b/src/tools/cppunit/TestShell.cpp index 0d6a8c4438..37f2167889 100644 --- a/src/tools/cppunit/TestShell.cpp +++ b/src/tools/cppunit/TestShell.cpp @@ -444,26 +444,28 @@ BTestShell::LoadDynamicSuites() { } set::iterator i; + int count = 0; for (i = fLibDirs.begin(); i != fLibDirs.end(); i++) { BDirectory libDir((*i).c_str()); if (Verbosity() >= v3) cout << "Checking " << *i << endl; -/* int count =*/ LoadSuitesFrom(&libDir); + count += LoadSuitesFrom(&libDir); if (Verbosity() >= v3) { -// cout << "Loaded " << count << " suite" << (count == 1 ? "" : "s"); -// cout << " from " << *i << endl; + cout << "Loaded " << count << " suite" << (count == 1 ? "" : "s"); + cout << " from " << *i << endl; } } - if (Verbosity() >= v3) + if (Verbosity() >= v3) { cout << endl; + } // Look for suites and tests with the same name and give a // warning, as this is only asking for trouble... :-) for (SuiteMap::const_iterator i = fSuites.begin(); i != fSuites.end(); i++) { if (fTests.find(i->first) != fTests.end() && Verbosity() > v0) { cout << "WARNING: '" << i->first << "' refers to both a test suite *and* an individual" << - endl << " test. Both will be executed, but it is reccommended you rename" << + endl << " test. Both will be executed, but it is recommended you rename" << endl << " one of them to resolve the conflict." << endl << endl; }