haiku_unittests.hpkg: fix unittests dependency
* Add rules for files required for tests execution. Change-Id: I2954f5dbec07af51ccdc9fd3389d530cf47ec0fd Reviewed-on: https://review.haiku-os.org/c/haiku/+/10265 Haiku-Format: Haiku-format Bot <[email protected]> Reviewed-by: Alexander von Gluck <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Alexander von Gluck
parent
d52ea5c8d2
commit
ccbb6eb32d
@@ -37,6 +37,42 @@ rule UnitTestLib
|
|||||||
SharedLibrary $(lib) : $(sources) : $(libraries) libcppunit.so ;
|
SharedLibrary $(lib) : $(sources) : $(libraries) libcppunit.so ;
|
||||||
|
|
||||||
UnitTestDependency $(lib) ;
|
UnitTestDependency $(lib) ;
|
||||||
|
UNIT_TEST_LIBRARIES on unittests += $(lib) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rule UnitTestResource
|
||||||
|
{
|
||||||
|
# UnitTestResource <target> : <source> : <flags> ;
|
||||||
|
#
|
||||||
|
# <flags> supported values: isExec
|
||||||
|
local target = $(1:G=tests!unittests!resources) ;
|
||||||
|
local source = $(2) ;
|
||||||
|
local flags = $(3) ;
|
||||||
|
|
||||||
|
MakeLocate $(target) : [ FDirName $(TARGET_UNIT_TEST_DIR) resources ] ;
|
||||||
|
File $(target) : $(source) ;
|
||||||
|
if isExec in $(flags) {
|
||||||
|
MODE on $(target) = $(EXEMODE) ;
|
||||||
|
}
|
||||||
|
MimeSet $(target) ;
|
||||||
|
UnitTestDependency $(target) ;
|
||||||
|
UNIT_TEST_RESOURCES on unittests += $(target) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rule UnitTestResources
|
||||||
|
{
|
||||||
|
# UnitTestResources <files> : <sourceDir> : <flags> ;
|
||||||
|
#
|
||||||
|
# <flags> supports same values as UnitTestResource
|
||||||
|
local files = $(1) ;
|
||||||
|
local sourceDir = $(2) ;
|
||||||
|
local flags = $(3) ;
|
||||||
|
for file in $(files) {
|
||||||
|
LOCATE on $(file) = $(sourceDir) ;
|
||||||
|
UnitTestResource $(file:G=tests!unittests!resources) : $(file) : $(flags) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -67,6 +103,7 @@ rule UnitTest
|
|||||||
: $(resources) ;
|
: $(resources) ;
|
||||||
|
|
||||||
UnitTestDependency $(target) ;
|
UnitTestDependency $(target) ;
|
||||||
|
UNIT_TEST_EXECUTABLES on unittests += $(target) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
local haikuUnitTestsPackage = haiku_unittests.hpkg ;
|
local haikuUnitTestsPackage = haiku_unittests.hpkg ;
|
||||||
HaikuPackage $(haikuUnitTestsPackage) ;
|
HaikuPackage $(haikuUnitTestsPackage) ;
|
||||||
|
|
||||||
CopyDirectoryToPackage add-ons
|
local libraries = [ on unittests return $(UNIT_TEST_LIBRARIES) ] ;
|
||||||
:
|
local executables = [ on unittests return $(UNIT_TEST_EXECUTABLES) ] ;
|
||||||
$(TARGET_UNIT_TEST_DIR)
|
local resources = [ on unittests return $(UNIT_TEST_RESOURCES) ] ;
|
||||||
;
|
|
||||||
|
AddFilesToPackage add-ons unittests lib : $(libraries) ;
|
||||||
|
AddFilesToPackage add-ons unittests resources : $(resources) ;
|
||||||
|
AddFilesToPackage add-ons unittests : $(executables) ;
|
||||||
|
|
||||||
BuildHaikuPackage $(haikuUnitTestsPackage) : haiku_unittests ;
|
BuildHaikuPackage $(haikuUnitTestsPackage) : haiku_unittests ;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ exec(const std::vector<std::string>& args)
|
|||||||
std::string
|
std::string
|
||||||
TestFilePath(const std::string& relativePath)
|
TestFilePath(const std::string& relativePath)
|
||||||
{
|
{
|
||||||
return relativePath;
|
return "resources/" + relativePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ void SendAuthenticatedRequest(
|
|||||||
// Return the path of a file path relative to this source file.
|
// Return the path of a file path relative to this source file.
|
||||||
std::string TestFilePath(const std::string& relativePath)
|
std::string TestFilePath(const std::string& relativePath)
|
||||||
{
|
{
|
||||||
return relativePath;
|
return "resources/" + relativePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,20 +4,6 @@ UsePrivateHeaders netservices private shared ;
|
|||||||
|
|
||||||
AddSubDirSupportedPlatforms libbe_test ;
|
AddSubDirSupportedPlatforms libbe_test ;
|
||||||
|
|
||||||
rule CopyScript # cloned CopyBAppTestApp
|
|
||||||
{
|
|
||||||
# CopyScript <target> : <source> ;
|
|
||||||
local target = $(1) ;
|
|
||||||
local source = $(2) ;
|
|
||||||
|
|
||||||
MakeLocate $(target) : $(TARGET_UNIT_TEST_DIR) ;
|
|
||||||
File $(target) : $(source) ;
|
|
||||||
MODE on $(target) = $(EXEMODE) ;
|
|
||||||
MimeSet $(target) ;
|
|
||||||
|
|
||||||
UnitTestDependency $(target) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
UnitTestLib servicekittest.so :
|
UnitTestLib servicekittest.so :
|
||||||
ServiceKitTestAddon.cpp
|
ServiceKitTestAddon.cpp
|
||||||
|
|
||||||
@@ -32,6 +18,6 @@ UnitTestLib servicekittest.so :
|
|||||||
: be libnetservices.a shared $(TARGET_NETWORK_LIBS) $(HAIKU_NETAPI_LIB)
|
: be libnetservices.a shared $(TARGET_NETWORK_LIBS) $(HAIKU_NETAPI_LIB)
|
||||||
[ TargetLibstdc++ ]
|
[ TargetLibstdc++ ]
|
||||||
;
|
;
|
||||||
CopyScript <tests!unittests>proxy.py : proxy.py ;
|
|
||||||
CopyScript <tests!unittests>testserver.py : testserver.py ;
|
UnitTestResources proxy.py testserver.py : : isExec ;
|
||||||
CopyScript <tests!unittests>testfile.txt : testfile.txt ;
|
UnitTestResources testfile.txt ;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void exec(const std::vector<std::string>& args)
|
|||||||
// Return the path of a file path relative to this source file.
|
// Return the path of a file path relative to this source file.
|
||||||
std::string TestFilePath(const std::string& relativePath)
|
std::string TestFilePath(const std::string& relativePath)
|
||||||
{
|
{
|
||||||
return relativePath;
|
return "resources/" + relativePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,28 +28,11 @@ UnitTestLib libstoragetest.so
|
|||||||
: be [ TargetLibstdc++ ]
|
: 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.
|
# To run the tests some test files must be around.
|
||||||
{
|
{
|
||||||
local sourceDir = src tests kits storage resources ;
|
local sourceDir = [ FDirName $(HAIKU_TOP) src tests kits storage resources ] ;
|
||||||
local files = elf elf-no-res pef pef-no-res ppc.rsrc x86.rsrc ;
|
UnitTestResources elf elf-no-res pef pef-no-res : $(sourceDir) : isExec ;
|
||||||
local sourceDirName = [ FDirName $(HAIKU_TOP) $(sourceDir) ] ;
|
UnitTestResources ppc.rsrc x86.rsrc : $(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 ;
|
SubInclude HAIKU_TOP src tests kits storage disk_device ;
|
||||||
|
|||||||
Reference in New Issue
Block a user