⛏️ index : haiku.git

Diff

 build/jam/DefaultBuildProfiles                 | 23 +++++++++++++++++++++++
 build/jam/HaikuPackages                        |  4 ++++
 build/jam/images/HaikuImage                    |  6 ++++++
 build/jam/packages/HaikuUnitTests              |  9 +++++++++
 build/jam/repositories/Haiku                   |  4 ++++
 src/tools/cppunit/Jamfile                      | 10 ++--------
 src/tools/cppunit/TestShell.cpp                | 12 +++++++-----
 src/data/package_infos/generic/haiku_unittests | 19 +++++++++++++++++++
 src/tests/kits/storage/Jamfile                 | 24 ++++++++++++++++++++++++
 9 files changed, 94 insertions(+), 17 deletions(-)

diff --git a/build/jam/DefaultBuildProfiles b/build/jam/DefaultBuildProfiles
index 25b19ca..48b2304 100644
--- a/build/jam/DefaultBuildProfiles
+++ b/build/jam/DefaultBuildProfiles
@@ -20,6 +20,14 @@
		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 ;
@@ -63,6 +71,9 @@
	DefineBuildProfile minimum-cd : cd-image : "haiku-minimum.iso" ;
	DefineBuildProfile minimum-anyboot : anyboot-image
		: "haiku-minimum-anyboot.iso" ;

	# test profiles
	DefineBuildProfile test-raw : image : "haiku-test.image" ;

	switch $(HAIKU_BUILD_PROFILE) {
		case "release-*" : {
@@ -166,6 +177,18 @@

		case "minimum-*" : {
			Echo Building Haiku Minimum Target ;
			HAIKU_IMAGE_HOST_NAME ?= shredder ;
			if $(DEBUG) != 0 {
				HAIKU_IMAGE_SIZE ?= 450 ;
			}

			AddHaikuImageSystemPackages
				openssl3
				;
		}

		case "test-*" : {
			Echo Building Haiku UnitTest Target ;
			HAIKU_IMAGE_HOST_NAME ?= shredder ;
			if $(DEBUG) != 0 {
				HAIKU_IMAGE_SIZE ?= 450 ;
diff --git a/build/jam/HaikuPackages b/build/jam/HaikuPackages
index fe23c62..904ff10 100644
--- a/build/jam/HaikuPackages
+++ b/build/jam/HaikuPackages
@@ -18,6 +18,10 @@
	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 46cea5e..77ae4e8 100644
--- a/build/jam/images/HaikuImage
+++ b/build/jam/images/HaikuImage
@@ -7,6 +7,8 @@
	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 ] ;
}
@@ -22,6 +24,10 @@
	:
	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 0000000..6a01a13 100644
--- /dev/null
+++ b/build/jam/packages/HaikuUnitTests
@@ -1,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 b1a7d82..97a81b0 100644
--- a/build/jam/repositories/Haiku
+++ b/build/jam/repositories/Haiku
@@ -30,6 +30,10 @@
	}
}

if $(HAIKU_BUILD_TYPE) = test {
	packages += haiku_unittests ;
}

local webPositiveIsAvailable ;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
diff --git a/src/tools/cppunit/Jamfile b/src/tools/cppunit/Jamfile
index 7a7d0ed..ecff76f 100644
--- a/src/tools/cppunit/Jamfile
+++ b/src/tools/cppunit/Jamfile
@@ -15,6 +15,8 @@
	}
}

MakeLocate libcppunit.so : $(TARGET_UNIT_TEST_LIB_DIR) ;

SharedLibrary libcppunit.so :
	BTestCase.cpp
	BTestSuite.cpp
@@ -53,12 +55,4 @@

if  ( $(OS) = BEOS || $(OS) = HAIKU ) && $(OSPLAT) != PPC {
	LinkAgainst libcppunit.so : libelfsymbolpatcher.a debug ;
}

# To run the tests we need the cppunit library.
{
	local target = <src!tools!cppunit>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 0d6a8c4..37f2167 100644
--- a/src/tools/cppunit/TestShell.cpp
+++ b/src/tools/cppunit/TestShell.cpp
@@ -444,26 +444,28 @@
	}

	set<string>::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;
		}
diff --git a/src/data/package_infos/generic/haiku_unittests b/src/data/package_infos/generic/haiku_unittests
new file mode 100644
index 0000000..f7cc3f8 100644
--- /dev/null
+++ b/src/data/package_infos/generic/haiku_unittests
@@ -1,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 59a146f..af33ce2 100644
--- a/src/tests/kits/storage/Jamfile
+++ b/src/tests/kits/storage/Jamfile
@@ -28,12 +28,28 @@
	: 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 = <src!tests!kits!storage>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 ;