build: Introduce test image with haiku_unittests package
* Currently there is no dependency between haiku_unittests.hpkg and unittests target. unittests needs to be built before building test image. Change-Id: I7c729095db74687b154a4880fde7f15b474c3590 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2080 Reviewed-by: Kacper Kasper <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Kacper Kasper
parent
f6829b6ccf
commit
cbb8d73dc9
@@ -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
|
||||
}
|
||||
@@ -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 = <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 ;
|
||||
|
||||
@@ -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 = <src!tools!cppunit>libcppunit.so ;
|
||||
MakeLocate $(target) : $(TARGET_UNIT_TEST_LIB_DIR) ;
|
||||
RelSymLink $(target) : libcppunit.so ;
|
||||
Depends libcppunit.so : $(target) ;
|
||||
}
|
||||
|
||||
@@ -444,26 +444,28 @@ BTestShell::LoadDynamicSuites() {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user