From fa4502cdb5c17a9f23e546397ca567452b0e3525 Mon Sep 17 00:00:00 2001 From: Kacper Kasper Date: Sat, 10 Jan 2026 18:41:05 +0100 Subject: [PATCH] Fix unit tests to work with test_app_server * Test suite runs to completion (with failures). * Observed sporadic hang in "BMessageQueue::Concurrency Test #1 (with list)". * Disabled Deskbar tests because they can mess up system's Deskbar. Something like test_app_server needs to be provided. * Disabled B_CMAP8 conversion tests due to #19885. * Fixed typo in variable names in haikudepot Jamfile. * "TARGET_PLATFORM=libbe_test jam -q install-unittest-libs" should prepare complete testing environment. Change-Id: Ie73fc3aaec5e6f73e310421404acda08f0b7faf4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/10224 Tested-by: Commit checker robot Reviewed-by: Adrien Destugues --- src/apps/haikudepot/Jamfile | 16 ++-- src/kits/network/libnetservices/Jamfile | 2 + src/kits/network/libnetservices2/Jamfile | 2 + src/kits/support/Url.cpp | 14 +-- src/tests/Jamfile | 3 +- src/tests/apps/haikudepot/Jamfile | 48 ++++++++-- .../kits/interface/InterfaceKitTestAddon.cpp | 2 +- src/tests/kits/interface/Jamfile | 8 +- .../kits/interface/OutlineListViewTest.cpp | 11 ++- .../kits/interface/bbitmap/SetBitsTester.cpp | 96 +++++++++---------- .../kits/interface/bdeskbar/DeskbarTest.cpp | 2 +- src/tests/kits/locale/Jamfile | 2 + src/tests/kits/media/Jamfile | 2 + src/tests/kits/net/libnetapi/Jamfile | 2 + .../kits/net/libnetapi/NetworkUrlTest.cpp | 68 ++++++------- .../kits/net/netservices2/TestServer.cpp | 7 +- src/tests/kits/net/service/CookieTest.cpp | 82 ++++++++-------- src/tests/kits/net/service/DataTest.cpp | 2 +- src/tests/kits/net/service/FileTest.cpp | 2 +- .../kits/net/service/GeolocationTest.cpp | 4 +- src/tests/kits/net/service/HttpTest.cpp | 19 ++-- src/tests/kits/net/service/Jamfile | 19 ++++ src/tests/kits/net/service/TestServer.cpp | 9 +- src/tests/kits/net/service/UrlTest.cpp | 18 ++-- src/tests/kits/shared/MemoryRingIOTest.cpp | 7 +- src/tests/kits/storage/AppFileInfoTest.cpp | 4 + .../kits/translation/TranslatorRosterTest.cpp | 9 +- src/tests/servers/launch/Jamfile | 3 +- .../system/kernel/util/BOpenHashTableTest.cpp | 6 +- src/tests/system/kernel/util/Jamfile | 1 + .../kernel/util/SinglyLinkedListTest.cpp | 6 +- 31 files changed, 266 insertions(+), 210 deletions(-) diff --git a/src/apps/haikudepot/Jamfile b/src/apps/haikudepot/Jamfile index 94edc986ea..169d1ea2de 100644 --- a/src/apps/haikudepot/Jamfile +++ b/src/apps/haikudepot/Jamfile @@ -13,7 +13,7 @@ HAIKUDEPOT_GENERATED_SOURCES_DIRECTORY = $(TARGET_COMMON_DEBUG_LOCATE_TARGET) ; # During the build process, some sources are generated into directories. These # are the directories. -local dumpExportRepositoryBulkListerTargetDirectory = +local dumpExportRepositoryBulkListenerTargetDirectory = [ FDirName $(HAIKUDEPOT_GENERATED_SOURCES_DIRECTORY) dumpexportrepositorybulklistener ] ; local dumpExportPkgBulkListenerTargetDirectory = @@ -40,8 +40,8 @@ local dumpExportReferenceModelTargetDirectory = local dummyFile = "dummy.dat" ; -local dumpExportRepositoryBulkListerTargetFile = - [ FDirName $(dumpExportRepositoryBulkListerTargetDirectory) $(dummyFile) ] ; +local dumpExportRepositoryBulkListenerTargetFile = + [ FDirName $(dumpExportRepositoryBulkListenerTargetDirectory) $(dummyFile) ] ; local dumpExportPkgBulkListenerTargetFile = [ FDirName $(dumpExportPkgBulkListenerTargetDirectory) $(dummyFile) ] ; local dumpExportReferenceListenerTargetFile = @@ -77,7 +77,7 @@ for sourceDir in $(sourceDirs) { SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src servers package ] ; -SEARCH_SOURCE += $(dumpExportRepositoryBulkListerTargetDirectory) ; +SEARCH_SOURCE += $(dumpExportRepositoryBulkListenerTargetDirectory) ; SEARCH_SOURCE += $(dumpExportPkgBulkListenerTargetDirectory) ; SEARCH_SOURCE += $(dumpExportReferenceListenerTargetDirectory) ; @@ -309,7 +309,7 @@ HdsSchemaGenModel $(dumpExportRepositoryModelTargetFile) HdsSchemaGenModel $(dumpExportReferenceModelTargetFile) : dumpexportreference.json : jsonschema2cppmodel.py ; -HdsSchemaGenBulkParser $(dumpExportRepositoryBulkListerTargetFile) +HdsSchemaGenBulkParser $(dumpExportRepositoryBulkListenerTargetFile) : dumpexportrepository.json : jsonschema2cppparser.py ; HdsSchemaGenBulkParser $(dumpExportPkgBulkListenerTargetFile) @@ -327,8 +327,8 @@ HdsSchemaGenAppSrcDependsOnGeneration HdsSchemaGenAppSrcDependsOnGeneration [ FGristFiles $(generatedRepositoryParserSourceFiles) ] [ FGristFiles $(generatedRepositoryParserSourceFiles:S=.h) ] - : $(dumpExportRepositoryBulkListerTargetDirectory) - : $(dumpExportRepositoryBulkListerTargetFile) ; + : $(dumpExportRepositoryBulkListenerTargetDirectory) + : $(dumpExportRepositoryBulkListenerTargetFile) ; HdsSchemaGenAppSrcDependsOnGeneration [ FGristFiles $(generatedReferenceParserSourceFiles) ] @@ -359,7 +359,7 @@ HdsSchemaGenAppSrcDependsOnGeneration Includes [ FGristFiles $(applicationSources) ] : - $(dumpExportRepositoryBulkListerTargetDirectory) + $(dumpExportRepositoryBulkListenerTargetDirectory) $(dumpExportPkgBulkListenerTargetDirectory) $(dumpExportReferenceListenerTargetDirectory) $(dumpExportPkgModelTargetDirectory) diff --git a/src/kits/network/libnetservices/Jamfile b/src/kits/network/libnetservices/Jamfile index de7ab3d18e..85026b6b66 100644 --- a/src/kits/network/libnetservices/Jamfile +++ b/src/kits/network/libnetservices/Jamfile @@ -2,6 +2,8 @@ SubDir HAIKU_TOP src kits network libnetservices ; UsePrivateHeaders net netservices shared support ; +AddSubDirSupportedPlatforms libbe_test ; + if [ Glob $(SUBDIR) : DefaultGeolocationServiceKey.h ] { SubDirC++Flags [ FDefines HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY ] ; } diff --git a/src/kits/network/libnetservices2/Jamfile b/src/kits/network/libnetservices2/Jamfile index 8018be4e2c..19ee5f4e73 100644 --- a/src/kits/network/libnetservices2/Jamfile +++ b/src/kits/network/libnetservices2/Jamfile @@ -5,6 +5,8 @@ UsePrivateHeaders netservices2 ; UsePrivateHeaders support ; UsePrivateHeaders shared ; +AddSubDirSupportedPlatforms libbe_test ; + local architectureObject ; for architectureObject in [ MultiArchSubDirSetup ] { on $(architectureObject) { diff --git a/src/kits/support/Url.cpp b/src/kits/support/Url.cpp index 43b8c585cc..19c10bc3ee 100644 --- a/src/kits/support/Url.cpp +++ b/src/kits/support/Url.cpp @@ -18,11 +18,11 @@ #include #include -#ifdef HAIKU_TARGET_PLATFORM_HAIKU +#if defined(HAIKU_TARGET_PLATFORM_HAIKU) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) #include #endif -#ifdef HAIKU_TARGET_PLATFORM_HAIKU +#if defined(HAIKU_TARGET_PLATFORM_HAIKU) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) #include #include #endif @@ -614,7 +614,7 @@ BUrl::HasFragment() const } -#ifdef HAIKU_TARGET_PLATFORM_HAIKU +#if defined(HAIKU_TARGET_PLATFORM_HAIKU) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) status_t BUrl::IDNAToAscii() { @@ -638,7 +638,7 @@ BUrl::IDNAToAscii() #endif -#ifdef HAIKU_TARGET_PLATFORM_HAIKU +#if defined(HAIKU_TARGET_PLATFORM_HAIKU) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) status_t BUrl::IDNAToUnicode() { @@ -665,7 +665,7 @@ BUrl::IDNAToUnicode() // #pragma mark - utility functionality -#ifdef HAIKU_TARGET_PLATFORM_HAIKU +#if defined(HAIKU_TARGET_PLATFORM_HAIKU) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) bool BUrl::HasPreferredApplication() const { @@ -681,7 +681,7 @@ BUrl::HasPreferredApplication() const #endif -#ifdef HAIKU_TARGET_PLATFORM_HAIKU +#if defined(HAIKU_TARGET_PLATFORM_HAIKU) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) BString BUrl::PreferredApplication() const { @@ -695,7 +695,7 @@ BUrl::PreferredApplication() const #endif -#ifdef HAIKU_TARGET_PLATFORM_HAIKU +#if defined(HAIKU_TARGET_PLATFORM_HAIKU) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) status_t BUrl::OpenWithPreferredApplication(bool onProblemAskUser) const { diff --git a/src/tests/Jamfile b/src/tests/Jamfile index a1acf2290b..2533bf9467 100644 --- a/src/tests/Jamfile +++ b/src/tests/Jamfile @@ -17,10 +17,11 @@ UnitTest UnitTester # Install libbe and other libraries for target platform libbe_test. if $(TARGET_PLATFORM) = libbe_test { - local libs = libbe_haiku.so libbeadapter.so libtranslation.so ; + local libs = libbe_test.so libtranslation.so ; HaikuInstall install-unittest-libs : $(TARGET_UNIT_TEST_LIB_DIR) : $(libs) : tests!unittests ; + Depends install-unittest-libs : unittests ; } SubInclude HAIKU_TOP src tests add-ons ; diff --git a/src/tests/apps/haikudepot/Jamfile b/src/tests/apps/haikudepot/Jamfile index 265be30a31..9fcac06041 100644 --- a/src/tests/apps/haikudepot/Jamfile +++ b/src/tests/apps/haikudepot/Jamfile @@ -2,6 +2,8 @@ SubDir HAIKU_TOP src tests apps haikudepot ; AddSubDirSupportedPlatforms libbe_test ; +include [ FDirName $(HAIKU_TOP) src apps haikudepot build jam HdsSchemaGenRules ] ; + SubDirHdrs [ FDirName $(HAIKU_TOP) src apps haikudepot ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) src apps haikudepot model ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) src apps haikudepot server ] ; @@ -25,10 +27,42 @@ local sourceDir ; for sourceDir in $(sourceDirs) { SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps haikudepot $(sourceDir) ] ; } -SEARCH_SOURCE += [ FDirName $(HAIKUDEPOT_GENERATED_SOURCES_DIRECTORY) - dumpexportrepositorybulklistener ] ; -SEARCH_SOURCE += [ FDirName $(HAIKUDEPOT_GENERATED_SOURCES_DIRECTORY) - dumpexportrepositorymodel ] ; +local dumpExportRepositoryBulkListenerTargetDirectory = + [ FDirName $(HAIKUDEPOT_GENERATED_SOURCES_DIRECTORY) + dumpexportrepositorybulklistener ] ; +local dumpExportRepositoryModelTargetDirectory = + [ FDirName $(HAIKUDEPOT_GENERATED_SOURCES_DIRECTORY) + dumpexportrepositorymodel ] ; +SEARCH_SOURCE += $(dumpExportRepositoryBulkListenerTargetDirectory) ; +SEARCH_SOURCE += $(dumpExportRepositoryModelTargetDirectory) ; + +local generatedRepositoryModelSourceFiles = + DumpExportRepository.cpp + DumpExportRepositorySource.cpp + DumpExportRepositorySourceMirror.cpp +; +local generatedRepositoryParserSourceFiles = + DumpExportRepositoryJsonListener.cpp +; + +local dummyFile = "dummy.dat" ; + +local dumpExportRepositoryBulkListenerTargetFile = + [ FDirName $(dumpExportRepositoryBulkListenerTargetDirectory) $(dummyFile) ] ; +local dumpExportRepositoryModelTargetFile = + [ FDirName $(dumpExportRepositoryModelTargetDirectory) $(dummyFile) ] ; + +HdsSchemaGenAppSrcDependsOnGeneration + $(generatedRepositoryParserSourceFiles) + $(generatedRepositoryParserSourceFiles:S=.h) + : $(dumpExportRepositoryBulkListenerTargetDirectory) + : $(dumpExportRepositoryBulkListenerTargetFile) ; + +HdsSchemaGenAppSrcDependsOnGeneration + $(generatedRepositoryModelSourceFiles) + $(generatedRepositoryModelSourceFiles:S=.h) + : $(dumpExportRepositoryModelTargetDirectory) + : $(dumpExportRepositoryModelTargetFile) ; UnitTestLib haikudepottest.so : HaikuDepotTestAddon.cpp @@ -36,10 +70,8 @@ UnitTestLib haikudepottest.so : DataIOUtils.cpp DataIOUtilsTest.cpp - DumpExportRepositorySource.cpp - DumpExportRepositorySourceMirror.cpp - DumpExportRepository.cpp - DumpExportRepositoryJsonListener.cpp + $(generatedRepositoryModelSourceFiles) + $(generatedRepositoryParserSourceFiles) DumpExportRepositoryJsonListenerTest.cpp JwtTokenHelper.cpp diff --git a/src/tests/kits/interface/InterfaceKitTestAddon.cpp b/src/tests/kits/interface/InterfaceKitTestAddon.cpp index 37943cf1f1..4e6e6967f2 100644 --- a/src/tests/kits/interface/InterfaceKitTestAddon.cpp +++ b/src/tests/kits/interface/InterfaceKitTestAddon.cpp @@ -23,7 +23,7 @@ getTestSuite() // ##### Add test suites here ##### suite->addTest("BAlert", AlertTest::Suite()); suite->addTest("BBitmap", BitmapTestSuite()); - suite->addTest("BDeskbar", DeskbarTestSuite()); +// suite->addTest("BDeskbar", DeskbarTestSuite()); suite->addTest("BOutlineListView", OutlineListViewTestSuite()); suite->addTest("BMenu", MenuTestSuite()); suite->addTest("BPolygon", PolygonTestSuite()); diff --git a/src/tests/kits/interface/Jamfile b/src/tests/kits/interface/Jamfile index eed6c191b0..0515bf69d6 100644 --- a/src/tests/kits/interface/Jamfile +++ b/src/tests/kits/interface/Jamfile @@ -31,10 +31,10 @@ UnitTestLib libinterfacetest.so SetBitsTester.cpp # BDeskbar - DeskbarTest.cpp - DeskbarGetItemTest.cpp - DeskbarLocationTest.cpp - DeskbarAddItemTest.cpp +# DeskbarTest.cpp +# DeskbarGetItemTest.cpp +# DeskbarLocationTest.cpp +# DeskbarAddItemTest.cpp # BPolygon PolygonTest.cpp diff --git a/src/tests/kits/interface/OutlineListViewTest.cpp b/src/tests/kits/interface/OutlineListViewTest.cpp index d6b92ac68b..b72e2e6f7f 100644 --- a/src/tests/kits/interface/OutlineListViewTest.cpp +++ b/src/tests/kits/interface/OutlineListViewTest.cpp @@ -73,6 +73,13 @@ class OutlineListViewTest: public TestCase OutlineListViewTest() {} OutlineListViewTest(std::string name) : TestCase(name) {} + void setUp() { + fApplication = new BApplication("application/x-vnd.OutlineListView.test"); + } + void tearDown() { + delete fApplication; + } + void EachItemUnder(); void AddUnder(); void ItemUnderAt(); @@ -80,6 +87,7 @@ class OutlineListViewTest: public TestCase static Test* Suite(); private: + BApplication *fApplication; static BOutlineListView* _SetupTest(const char* name); }; @@ -271,9 +279,6 @@ OutlineListViewTest::Suite() BOutlineListView* OutlineListViewTest::_SetupTest(const char* name) { - if (be_app == NULL) - new BApplication("application/x-vnd.OutlineListView.test"); - BWindow* window = new BWindow(BRect(50, 50, 550, 550), name, B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE, 0); diff --git a/src/tests/kits/interface/bbitmap/SetBitsTester.cpp b/src/tests/kits/interface/bbitmap/SetBitsTester.cpp index 162348a170..368d134ed4 100644 --- a/src/tests/kits/interface/bbitmap/SetBitsTester.cpp +++ b/src/tests/kits/interface/bbitmap/SetBitsTester.cpp @@ -505,13 +505,13 @@ void SetBitsTester::SetBits1() rgb32_test_data3_final); test_set_bits(rgb32_test_data4_initial, rgb32_test_data4_set, rgb32_test_data4_final); - test_set_bits(cmap8_test_data4_initial, cmap8_test_data4_set, - cmap8_test_data4_final); +// test_set_bits(cmap8_test_data4_initial, cmap8_test_data4_set, +// cmap8_test_data4_final); - test_set_bits(rgb32_test_data4_initial, cmap8_test_data4_set, - rgb32_test_data4_final); - test_set_bits(cmap8_test_data4_initial, rgb32_test_data4_set, - cmap8_test_data4_final); +// test_set_bits(rgb32_test_data4_initial, cmap8_test_data4_set, +// rgb32_test_data4_final); +// test_set_bits(cmap8_test_data4_initial, rgb32_test_data4_set, +// cmap8_test_data4_final); #endif } @@ -525,16 +525,16 @@ void SetBitsTester::SetBits1() void SetBitsTester::SetBits2() { BApplication app("application/x-vnd.obos.bitmap-setbits-test"); - test_set_bits(cmap8_test_data3_initial, cmap8_test_data3_set, - cmap8_test_data3_final); +// test_set_bits(cmap8_test_data3_initial, cmap8_test_data3_set, +// cmap8_test_data3_final); test_set_bits(gray1_test_data3_initial, gray1_test_data3_set, gray1_test_data3_final); test_set_bits(gray1_test_data4_initial, gray1_test_data4_set, gray1_test_data4_final); // ignores source row padding - test_set_bits(rgb32_test_data3a_initial, cmap8_test_data3a_set, - rgb32_test_data3_final); +// test_set_bits(rgb32_test_data3a_initial, cmap8_test_data3a_set, +// rgb32_test_data3_final); #ifndef TEST_R5 // R5: broken: no effect test_set_bits(rgb32_test_data3a_initial, gray1_test_data3_set, @@ -542,13 +542,13 @@ void SetBitsTester::SetBits2() test_set_bits(rgb32_test_data4a_initial, gray1_test_data4_set, rgb32_test_data4g_final); // R5: broken: ignores target bitmap row padding - test_set_bits(cmap8_test_data3_initial, rgb32_test_data3_set, - cmap8_test_data3_final); +// test_set_bits(cmap8_test_data3_initial, rgb32_test_data3_set, +// cmap8_test_data3_final); // R5: broken: simply copies the data - test_set_bits(cmap8_test_data3_initial, gray1_test_data3_set, - cmap8_test_data3g_final); - test_set_bits(cmap8_test_data4_initial, gray1_test_data4_set, - cmap8_test_data4g_final); +// test_set_bits(cmap8_test_data3_initial, gray1_test_data3_set, +// cmap8_test_data3g_final); +// test_set_bits(cmap8_test_data4_initial, gray1_test_data4_set, +// cmap8_test_data4g_final); #endif } @@ -574,14 +574,14 @@ void SetBitsTester::SetBits3() rgb32_test_data3p_final); test_set_bits2(rgb32_test_data4_initial, rgb32_test_data4p_set, rgb32_test_data4p_final); - test_set_bits2(cmap8_test_data4_initial, cmap8_test_data4p_set, - cmap8_test_data4p_final); +// test_set_bits2(cmap8_test_data4_initial, cmap8_test_data4p_set, +// cmap8_test_data4p_final); #endif - test_set_bits2(rgb32_test_data4_initial, cmap8_test_data4p_set, - rgb32_test_data4p_final); - test_set_bits2(cmap8_test_data4_initial, rgb32_test_data4p_set, - cmap8_test_data4p_final); +// test_set_bits2(rgb32_test_data4_initial, cmap8_test_data4p_set, +// rgb32_test_data4p_final); +// test_set_bits2(cmap8_test_data4_initial, rgb32_test_data4p_set, +// cmap8_test_data4p_final); } /* @@ -594,15 +594,15 @@ void SetBitsTester::SetBits3() void SetBitsTester::SetBits4() { BApplication app("application/x-vnd.obos.bitmap-setbits-test"); - test_set_bits2(cmap8_test_data3_initial, cmap8_test_data3p_set, - cmap8_test_data3p_final); +// test_set_bits2(cmap8_test_data3_initial, cmap8_test_data3p_set, +// cmap8_test_data3p_final); - test_set_bits2(rgb32_test_data3_initial, cmap8_test_data3ap_set, - rgb32_test_data3p_final); +// test_set_bits2(rgb32_test_data3_initial, cmap8_test_data3ap_set, +// rgb32_test_data3p_final); // R5: broken: ignores target bitmap row padding #ifndef TEST_R5 - test_set_bits2(cmap8_test_data3_initial, rgb32_test_data3p_set, - cmap8_test_data3p_final); +// test_set_bits2(cmap8_test_data3_initial, rgb32_test_data3p_set, +// cmap8_test_data3p_final); #endif } @@ -646,40 +646,40 @@ void SetBitsTester::ImportBitsA3() // B_RGB32 test_import_bits(rgb32_test_data3_initial, rgb32_test_data3_final, rgb32_test_data3_final); - test_import_bits(rgb32_test_data3_initial, cmap8_test_data3_final, - rgb32_test_data3_final); +// test_import_bits(rgb32_test_data3_initial, cmap8_test_data3_final, +// rgb32_test_data3_final); test_import_bits(rgb32_test_data3_initial, gray1_test_data3_final, rgb32_test_data3g_final); test_import_bits(rgb32_test_data4_initial, rgb32_test_data4_final, rgb32_test_data4_final); - test_import_bits(rgb32_test_data4_initial, cmap8_test_data4_final, - rgb32_test_data4_final); +// test_import_bits(rgb32_test_data4_initial, cmap8_test_data4_final, +// rgb32_test_data4_final); test_import_bits(rgb32_test_data4_initial, gray1_test_data4_final, rgb32_test_data4g_final); // B_CMAP8 - test_import_bits(cmap8_test_data3_initial, rgb32_test_data3_final, - cmap8_test_data3_final); - test_import_bits(cmap8_test_data3_initial, cmap8_test_data3_final, - cmap8_test_data3_final); - test_import_bits(cmap8_test_data3_initial, gray1_test_data3_final, - cmap8_test_data3g_final); - test_import_bits(cmap8_test_data4_initial, rgb32_test_data4_final, - cmap8_test_data4_final); - test_import_bits(cmap8_test_data4_initial, cmap8_test_data4_final, - cmap8_test_data4_final); - test_import_bits(cmap8_test_data4_initial, gray1_test_data4_final, - cmap8_test_data4g_final); +// test_import_bits(cmap8_test_data3_initial, rgb32_test_data3_final, +// cmap8_test_data3_final); +// test_import_bits(cmap8_test_data3_initial, cmap8_test_data3_final, +// cmap8_test_data3_final); +// test_import_bits(cmap8_test_data3_initial, gray1_test_data3_final, +// cmap8_test_data3g_final); +// test_import_bits(cmap8_test_data4_initial, rgb32_test_data4_final, +// cmap8_test_data4_final); +// test_import_bits(cmap8_test_data4_initial, cmap8_test_data4_final, +// cmap8_test_data4_final); +// test_import_bits(cmap8_test_data4_initial, gray1_test_data4_final, +// cmap8_test_data4g_final); // B_GRAY1 test_import_bits(gray1_test_data3_initial, rgb32_test_data3_final, gray1_test_data3_final); - test_import_bits(gray1_test_data3_initial, cmap8_test_data3_final, - gray1_test_data3_final); +// test_import_bits(gray1_test_data3_initial, cmap8_test_data3_final, +// gray1_test_data3_final); test_import_bits(gray1_test_data3_initial, gray1_test_data3_final, gray1_test_data3_final); test_import_bits(gray1_test_data4_initial, rgb32_test_data4_final, gray1_test_data4_final); - test_import_bits(gray1_test_data4_initial, cmap8_test_data4_final, - gray1_test_data4_final); +// test_import_bits(gray1_test_data4_initial, cmap8_test_data4_final, +// gray1_test_data4_final); test_import_bits(gray1_test_data4_initial, gray1_test_data4_final, gray1_test_data4_final); } diff --git a/src/tests/kits/interface/bdeskbar/DeskbarTest.cpp b/src/tests/kits/interface/bdeskbar/DeskbarTest.cpp index 7d192b06bf..4d34aba8fa 100644 --- a/src/tests/kits/interface/bdeskbar/DeskbarTest.cpp +++ b/src/tests/kits/interface/bdeskbar/DeskbarTest.cpp @@ -6,7 +6,7 @@ Test *DeskbarTestSuite() { TestSuite *testSuite = new TestSuite(); - + testSuite->addTest(DeskbarGetItemTest::suite()); testSuite->addTest(DeskbarLocationTest::suite()); testSuite->addTest(DeskbarAddItemTest::suite()); diff --git a/src/tests/kits/locale/Jamfile b/src/tests/kits/locale/Jamfile index e02ae24866..ba32ce4103 100644 --- a/src/tests/kits/locale/Jamfile +++ b/src/tests/kits/locale/Jamfile @@ -4,6 +4,8 @@ UsePublicHeaders locale ; UsePrivateHeaders locale shared ; UseBuildFeatureHeaders icu ; +AddSubDirSupportedPlatforms libbe_test ; + # Pseudo target to build all locale kit tests NotFile LocaleKitTests ; Depends LocaleKitTests diff --git a/src/tests/kits/media/Jamfile b/src/tests/kits/media/Jamfile index 717d774460..99ab31958b 100644 --- a/src/tests/kits/media/Jamfile +++ b/src/tests/kits/media/Jamfile @@ -1,5 +1,7 @@ SubDir HAIKU_TOP src tests kits media ; +AddSubDirSupportedPlatforms libbe_test ; + SimpleTest TimedEventQueueTest : TimedEventQueueTest.cpp : libmedia.so be ; diff --git a/src/tests/kits/net/libnetapi/Jamfile b/src/tests/kits/net/libnetapi/Jamfile index 6a7d8fa12d..e6655d3e8a 100644 --- a/src/tests/kits/net/libnetapi/Jamfile +++ b/src/tests/kits/net/libnetapi/Jamfile @@ -1,5 +1,7 @@ SubDir HAIKU_TOP src tests kits net libnetapi ; +AddSubDirSupportedPlatforms libbe_test ; + UnitTestLib libnetapitest.so : NetAPITestAddon.cpp diff --git a/src/tests/kits/net/libnetapi/NetworkUrlTest.cpp b/src/tests/kits/net/libnetapi/NetworkUrlTest.cpp index 592ff4d505..00e61f8ce1 100644 --- a/src/tests/kits/net/libnetapi/NetworkUrlTest.cpp +++ b/src/tests/kits/net/libnetapi/NetworkUrlTest.cpp @@ -43,7 +43,7 @@ parsed elements successfully processes and the elements are present. void NetworkUrlTest::TestValidFullUrl() { - BUrl url("http://ewe:pea@www.something.co.nz:8888/some/path?key1=value1#fragment"); + BUrl url("http://ewe:pea@www.something.co.nz:8888/some/path?key1=value1#fragment", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "http"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -66,7 +66,7 @@ void NetworkUrlTest::TestValidFullUrl() void NetworkUrlTest::TestHostWithPathAndFragment() { - BUrl url("http://1.2.3.4/some/path#frag/ment"); + BUrl url("http://1.2.3.4/some/path#frag/ment", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "http"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -85,7 +85,7 @@ void NetworkUrlTest::TestHostWithPathAndFragment() void NetworkUrlTest::TestHostWithFragment() { - BUrl url("http://1.2.3.4#frag/ment"); + BUrl url("http://1.2.3.4#frag/ment", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "http"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -103,7 +103,7 @@ void NetworkUrlTest::TestHostWithFragment() void NetworkUrlTest::TestIpv6HostPortPathAndRequest() { - BUrl url("http://[123:a3:0:E3::123]:8080/some/path?key1=value1"); + BUrl url("http://[123:a3:0:E3::123]:8080/some/path?key1=value1", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "http"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -123,7 +123,7 @@ void NetworkUrlTest::TestIpv6HostPortPathAndRequest() void NetworkUrlTest::TestFileUrl() { - BUrl url("file:///northisland/wellington/brooklyn/windturbine"); + BUrl url("file:///northisland/wellington/brooklyn/windturbine", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "file"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -141,7 +141,7 @@ void NetworkUrlTest::TestFileUrl() void NetworkUrlTest::TestDataUrl() { - BUrl url("data:image/png;base64,iVBORw0KGI12P4//8/w38GIErkJggg=="); + BUrl url("data:image/png;base64,iVBORw0KGI12P4//8/w38GIErkJggg==", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "data"); CPPUNIT_ASSERT(!url.HasUserName()); @@ -159,7 +159,7 @@ void NetworkUrlTest::TestDataUrl() void NetworkUrlTest::TestWithUserNameAndPasswordNoHostAndPort() { - BUrl url("wierd://tea:tree@/x"); + BUrl url("wierd://tea:tree@/x", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "wierd"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -179,7 +179,7 @@ void NetworkUrlTest::TestWithUserNameAndPasswordNoHostAndPort() void NetworkUrlTest::TestHostAndPortWithNoUserNameAndPassword() { - BUrl url("https://www.something.co.nz:443/z"); + BUrl url("https://www.something.co.nz:443/z", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "https"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -198,7 +198,7 @@ void NetworkUrlTest::TestHostAndPortWithNoUserNameAndPassword() void NetworkUrlTest::TestHostWithNoPortOrUserNameAndPassword() { - BUrl url("https://www.something.co.nz/z"); + BUrl url("https://www.something.co.nz/z", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "https"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -216,7 +216,7 @@ void NetworkUrlTest::TestHostWithNoPortOrUserNameAndPassword() void NetworkUrlTest::TestHostWithNoPortNoPath() { - BUrl url("https://www.something.co.nz"); + BUrl url("https://www.something.co.nz", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "https"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -233,7 +233,7 @@ void NetworkUrlTest::TestHostWithNoPortNoPath() void NetworkUrlTest::TestHostWithPortNoPath() { - BUrl url("https://www.something.co.nz:1234"); + BUrl url("https://www.something.co.nz:1234", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "https"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -251,7 +251,7 @@ void NetworkUrlTest::TestHostWithPortNoPath() void NetworkUrlTest::TestHostWithEmptyPort() { - BUrl url("https://www.something.co.nz:"); + BUrl url("https://www.something.co.nz:", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "https"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -268,7 +268,7 @@ void NetworkUrlTest::TestHostWithEmptyPort() void NetworkUrlTest::TestProtocol() { - BUrl url("olala:"); + BUrl url("olala:", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "olala"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -284,7 +284,7 @@ void NetworkUrlTest::TestProtocol() void NetworkUrlTest::TestMailTo() { - BUrl url("mailto:eric@example.com"); + BUrl url("mailto:eric@example.com", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.Protocol() == "mailto"); CPPUNIT_ASSERT(url.HasProtocol()); @@ -304,7 +304,7 @@ void NetworkUrlTest::TestMailTo() void NetworkUrlTest::TestAuthorityNoUserName() { - BUrl url("anything://:pwd@host"); + BUrl url("anything://:pwd@host", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(!url.HasUserName()); CPPUNIT_ASSERT(url.HasPassword()); @@ -317,7 +317,7 @@ void NetworkUrlTest::TestAuthorityNoUserName() void NetworkUrlTest::TestAuthorityWithCredentialsSeparatorNoPassword() { - BUrl url("anything://unam:@host"); + BUrl url("anything://unam:@host", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.HasUserName()); CPPUNIT_ASSERT(url.UserName() == "unam"); @@ -330,7 +330,7 @@ void NetworkUrlTest::TestAuthorityWithCredentialsSeparatorNoPassword() void NetworkUrlTest::TestAuthorityWithoutCredentialsSeparatorNoPassword() { - BUrl url("anything://unam@host"); + BUrl url("anything://unam@host", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(url.HasUserName()); CPPUNIT_ASSERT(url.UserName() == "unam"); @@ -343,7 +343,7 @@ void NetworkUrlTest::TestAuthorityWithoutCredentialsSeparatorNoPassword() void NetworkUrlTest::TestAuthorityBadPort() { - BUrl url("anything://host:aaa"); + BUrl url("anything://host:aaa", true); CPPUNIT_ASSERT(url.IsValid()); CPPUNIT_ASSERT(!url.HasUserName()); CPPUNIT_ASSERT(!url.HasPassword()); @@ -358,35 +358,35 @@ void NetworkUrlTest::TestAuthorityBadPort() void NetworkUrlTest::TestWhitespaceBefore() { - BUrl url(" https://www.something.co.nz/z"); + BUrl url(" https://www.something.co.nz/z", true); CPPUNIT_ASSERT(!url.IsValid()); } void NetworkUrlTest::TestWhitespaceAfter() { - BUrl url("https://www.something.co.nz/z\t\t "); + BUrl url("https://www.something.co.nz/z\t\t ", true); CPPUNIT_ASSERT(!url.IsValid()); } void NetworkUrlTest::TestWhitespaceMiddle() { - BUrl url("https://www. something.co.nz/z"); + BUrl url("https://www. something.co.nz/z", true); CPPUNIT_ASSERT(!url.IsValid()); } void NetworkUrlTest::TestHttpNoHost() { - BUrl url("https:///z"); + BUrl url("https:///z", true); CPPUNIT_ASSERT(!url.IsValid()); } void NetworkUrlTest::TestEmpty() { - BUrl url(""); + BUrl url("", true); CPPUNIT_ASSERT(!url.IsValid()); } @@ -397,30 +397,30 @@ void NetworkUrlTest::TestEmpty() void NetworkUrlTest::TestBadHosts() { CPPUNIT_ASSERT_MESSAGE("control check", - BUrl("http://host.example.com").IsValid()); + BUrl("http://host.example.com", true).IsValid()); CPPUNIT_ASSERT_MESSAGE("hyphen in middle", - (BUrl("http://host.peppermint_tea.com").IsValid())); + (BUrl("http://host.peppermint_tea.com", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("dot at end", - (BUrl("http://host.camomile.co.nz.").IsValid())); + (BUrl("http://host.camomile.co.nz.", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("simple host", - (BUrl("http://tumeric").IsValid())); + (BUrl("http://tumeric", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("idn domain encoded", - (BUrl("http://xn--bcher-kva.tld").IsValid())); + (BUrl("http://xn--bcher-kva.tld", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("idn domain unencoded", - (BUrl("http://www.b\xc3\xbcch.at").IsValid())); + (BUrl("http://www.b\xc3\xbcch.at", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("dot at start", - !(BUrl("http://.host.example.com").IsValid())); + !(BUrl("http://.host.example.com", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("double dot in domain", - !(BUrl("http://host.example..com").IsValid())); + !(BUrl("http://host.example..com", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("double dot", - !(BUrl("http://host.example..com").IsValid())); + !(BUrl("http://host.example..com", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("unexpected characters", - !(BUrl("http://").IsValid())); + !(BUrl("http://", true).IsValid())); CPPUNIT_ASSERT_MESSAGE("whitespace", - !(BUrl("http://host.exa ple.com").IsValid())); + !(BUrl("http://host.exa ple.com", true).IsValid())); } diff --git a/src/tests/kits/net/netservices2/TestServer.cpp b/src/tests/kits/net/netservices2/TestServer.cpp index 4fe5184ae6..9f0bfe0158 100644 --- a/src/tests/kits/net/netservices2/TestServer.cpp +++ b/src/tests/kits/net/netservices2/TestServer.cpp @@ -53,12 +53,7 @@ exec(const std::vector& args) std::string TestFilePath(const std::string& relativePath) { - char* testFileSource = strdup(__FILE__); - MemoryDeleter _(testFileSource); - - std::string testSrcDir(::dirname(testFileSource)); - - return testSrcDir + "/" + relativePath; + return relativePath; } } // namespace diff --git a/src/tests/kits/net/service/CookieTest.cpp b/src/tests/kits/net/service/CookieTest.cpp index 70970c2df9..f23163aa36 100644 --- a/src/tests/kits/net/service/CookieTest.cpp +++ b/src/tests/kits/net/service/CookieTest.cpp @@ -38,7 +38,7 @@ CookieTest::SimpleTest() { BNetworkCookieJar jar; char buffer[256]; - BUrl url("http://www.chipchapin.com/WebTools/cookietest.php"); + BUrl url("http://www.chipchapin.com/WebTools/cookietest.php", true); time_t t = time(NULL) + 6400; // Cookies expire in 1h45 struct tm* now = gmtime(&t); @@ -85,11 +85,11 @@ CookieTest::StandardTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/001.php"); + BUrl url("http://testsuites.opera.com/cookies/001.php", true); result = jar.AddCookie("001=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/001-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/001-1.php", true); const BNetworkCookie* cookie = _GetCookie(jar, url, "001"); CPPUNIT_ASSERT(cookie != NULL); @@ -111,15 +111,15 @@ CookieTest::ExpireTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/003.php"); + BUrl url("http://testsuites.opera.com/cookies/003.php", true); result = jar.AddCookie("003=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/003-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/003-1.php", true); result = jar.AddCookie("003=1; expires=Thu, 01-Jan-1970 00:00:10 GMT", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/003-2.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/003-2.php", true); // The cookie should be expired. CPPUNIT_ASSERT(_GetCookie(jar, url, "003") == NULL); } @@ -131,16 +131,16 @@ CookieTest::PathTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/004/004.php"); + BUrl url("http://testsuites.opera.com/cookies/004/004.php", true); result = jar.AddCookie("004=1", url); CPPUNIT_ASSERT(result == B_OK); // Page in the same path can access the cookie - url.SetUrlString("http://testsuites.opera.com/cookies/004/004-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/004/004-1.php", true); CPPUNIT_ASSERT(_GetCookie(jar, url, "004") != NULL); // Page in parent directory cannot access the cookie - url.SetUrlString("http://testsuites.opera.com/cookies/004-2.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/004-2.php", true); CPPUNIT_ASSERT(_GetCookie(jar, url, "004") == NULL); } @@ -151,7 +151,7 @@ CookieTest::MaxSizeTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/006.php"); + BUrl url("http://testsuites.opera.com/cookies/006.php", true); BString cookieString("006="); for (int i = 0; i < 128; i++) { cookieString << "00xxxxxxxxxxxxxx16xxxxxxxxxxxxxx"; @@ -159,7 +159,7 @@ CookieTest::MaxSizeTest() result = jar.AddCookie(cookieString, url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/006-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/006-1.php", true); const BNetworkCookie* cookie = _GetCookie(jar, url, "006"); CPPUNIT_ASSERT(cookie != NULL); CPPUNIT_ASSERT(cookie->Value().Length() == 4096); @@ -172,7 +172,7 @@ CookieTest::MaxNumberTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/007.php"); + BUrl url("http://testsuites.opera.com/cookies/007.php", true); BString cookieString; for (int i = 1; i <= 20; i++) @@ -182,7 +182,7 @@ CookieTest::MaxNumberTest() CPPUNIT_ASSERT(result == B_OK); } - url.SetUrlString("http://testsuites.opera.com/cookies/007-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/007-1.php", true); for (int i = 1; i <= 20; i++) { cookieString.SetToFormat("007-%d", i); @@ -199,15 +199,15 @@ CookieTest::UpdateTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/008.php"); + BUrl url("http://testsuites.opera.com/cookies/008.php", true); result = jar.AddCookie("008=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/008-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/008-1.php", true); result = jar.AddCookie("008=2", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/008-2.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/008-2.php", true); const BNetworkCookie* cookie = _GetCookie(jar, url, "008"); CPPUNIT_ASSERT(cookie != NULL); CPPUNIT_ASSERT(cookie->Value() == "2"); @@ -220,11 +220,11 @@ CookieTest::HttpOnlyTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/010.php"); + BUrl url("http://testsuites.opera.com/cookies/010.php", true); result = jar.AddCookie("010=1; Httponly; Max-age=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/010-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/010-1.php", true); const BNetworkCookie* cookie = _GetCookie(jar, url, "010"); CPPUNIT_ASSERT(cookie != NULL); CPPUNIT_ASSERT(cookie->Value() == "1"); @@ -239,11 +239,11 @@ CookieTest::EncodingTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/011.php"); + BUrl url("http://testsuites.opera.com/cookies/011.php", true); result = jar.AddCookie("011=UTF-8 \303\246\303\270\303\245 \346\227\245\346\234\254;", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/011-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/011-1.php", true); const BNetworkCookie* cookie = _GetCookie(jar, url, "011"); CPPUNIT_ASSERT(cookie != NULL); CPPUNIT_ASSERT_EQUAL( @@ -258,13 +258,13 @@ CookieTest::DomainTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/012.php"); + BUrl url("http://testsuites.opera.com/cookies/012.php", true); result = jar.AddCookie("012-1=1; Domain=\"opera.com\"", url); CPPUNIT_ASSERT(result == B_OK); result = jar.AddCookie("012-1=1; Domain=\"example.com\"", url); CPPUNIT_ASSERT(result != B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/012-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/012-1.php", true); const BNetworkCookie* cookie = _GetCookie(jar, url, "012-1"); CPPUNIT_ASSERT(cookie != NULL); CPPUNIT_ASSERT(cookie->Value() == "1"); @@ -286,7 +286,7 @@ CookieTest::PersistantTest() NextSubTest(); - BUrl url("http://testsuites.opera.com/cookies/013.php"); + BUrl url("http://testsuites.opera.com/cookies/013.php", true); strftime(buffer, sizeof(buffer), "013-1=1; Expires=%a, %d-%b-%Y %H:%M:%S", now); @@ -298,7 +298,7 @@ CookieTest::PersistantTest() NextSubTest(); - url.SetUrlString("http://testsuites.opera.com/cookies/013-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/013-1.php", true); const BNetworkCookie* cookie = _GetCookie(jar, url, "013-1"); CPPUNIT_ASSERT(cookie != NULL); @@ -331,21 +331,21 @@ CookieTest::OverwriteTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/015/015.php"); + BUrl url("http://testsuites.opera.com/cookies/015/015.php", true); result = jar.AddCookie("015-01=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/015-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/015-1.php", true); result = jar.AddCookie("015-01=1", url); result = jar.AddCookie("015-02=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/015/015-2.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/015/015-2.php", true); result = jar.AddCookie("015-01=1", url); result = jar.AddCookie("015-02=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/015/015-3.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/015/015-3.php", true); BNetworkCookieJar::UrlIterator it = jar.GetUrlIterator(url); int count = 0; @@ -364,15 +364,15 @@ CookieTest::OrderTest() BNetworkCookieJar jar; status_t result; - BUrl url("http://testsuites.opera.com/cookies/016.php"); + BUrl url("http://testsuites.opera.com/cookies/016.php", true); result = jar.AddCookie("016-01=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/016/016-1.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/016/016-1.php", true); result = jar.AddCookie("016-02=1", url); CPPUNIT_ASSERT(result == B_OK); - url.SetUrlString("http://testsuites.opera.com/cookies/016/016-2.php"); + url.SetUrlString("http://testsuites.opera.com/cookies/016/016-2.php", true); BNetworkCookieJar::UrlIterator it = jar.GetUrlIterator(url); int count = 0; @@ -401,7 +401,7 @@ CookieTest::OrderTest() void CookieTest::ExpireParsingTest() { - BUrl url("http://testsuites.opera.com/cookies/301.php"); + BUrl url("http://testsuites.opera.com/cookies/301.php", true); BNetworkCookie cookie; status_t result; @@ -523,11 +523,11 @@ CookieTest::ExpireParsingTest() void CookieTest::PathMatchingTest() { - const BUrl url("http://testsuites.opera.com/cookies/302/302.php"); - const BUrl url1("http://testsuites.opera.com/cookies/302-5.php"); - const BUrl url2("http://testsuites.opera.com/cookies/302/302-3.php"); - const BUrl url3("http://testsuites.opera.com/cookies/302/sub/302-4.php"); - const BUrl url4("http://testsuites.opera.com/cookies/302-2/302-6.php"); + const BUrl url("http://testsuites.opera.com/cookies/302/302.php", true); + const BUrl url1("http://testsuites.opera.com/cookies/302-5.php", true); + const BUrl url2("http://testsuites.opera.com/cookies/302/302-3.php", true); + const BUrl url3("http://testsuites.opera.com/cookies/302/sub/302-4.php", true); + const BUrl url4("http://testsuites.opera.com/cookies/302-2/302-6.php", true); BNetworkCookie cookie; status_t result; @@ -615,8 +615,8 @@ CookieTest::PathMatchingTest() void CookieTest::DomainMatchingTest() { - const BUrl setter("http://testsuites.opera.com/cookies/304.php"); - const BUrl getter("http://testsuites.opera.com/cookies/304-1.php"); + const BUrl setter("http://testsuites.opera.com/cookies/304.php", true); + const BUrl getter("http://testsuites.opera.com/cookies/304-1.php", true); BString bigData("304-12=1; Domain=\""); for (int i = 0; i < 1500; i++) @@ -668,7 +668,7 @@ CookieTest::DomainMatchingTest() void CookieTest::MaxAgeParsingTest() { - const BUrl setter("http://testsuites.opera.com/cookies/305.php"); + const BUrl setter("http://testsuites.opera.com/cookies/305.php", true); BString bigData("305-12=1; Max-Age=\""); for (int i = 0; i < 1500; i++) @@ -767,7 +767,7 @@ CookieTest::ExplodeTest() for (uint32 i = 0; i < (sizeof(tests) / sizeof(Test)); i++) { NextSubTest(); - BUrl url(tests[i].url); + BUrl url(tests[i].url, true); cookie.ParseCookieString(tests[i].cookieString, url); CPPUNIT_ASSERT(tests[i].expected.valid == cookie.IsValid()); diff --git a/src/tests/kits/net/service/DataTest.cpp b/src/tests/kits/net/service/DataTest.cpp index 936ef0728f..5c796a06b9 100644 --- a/src/tests/kits/net/service/DataTest.cpp +++ b/src/tests/kits/net/service/DataTest.cpp @@ -153,7 +153,7 @@ DataTest::_RunTest(BString url, const char* expected, size_t expectedLength) { NextSubTest(); - BUrl testUrl(url); + BUrl testUrl(url, true); BMallocIO buffer; ObjectDeleter requestDeleter( BUrlProtocolRoster::MakeRequest(testUrl, &buffer)); diff --git a/src/tests/kits/net/service/FileTest.cpp b/src/tests/kits/net/service/FileTest.cpp index 736c1dd65b..67e1befd9b 100644 --- a/src/tests/kits/net/service/FileTest.cpp +++ b/src/tests/kits/net/service/FileTest.cpp @@ -62,7 +62,7 @@ FileTest::StopTest() CHK(file.WriteExactly(content.String(), content.Length()) == B_OK); - BUrl url("file://"); + BUrl url("file://", true); url.SetPath(tmpl); BUrlRequest *request = BUrlProtocolRoster::MakeRequest(url, &listener); CHK(request != NULL); diff --git a/src/tests/kits/net/service/GeolocationTest.cpp b/src/tests/kits/net/service/GeolocationTest.cpp index d63301caee..7f9917449c 100644 --- a/src/tests/kits/net/service/GeolocationTest.cpp +++ b/src/tests/kits/net/service/GeolocationTest.cpp @@ -24,7 +24,7 @@ void GeolocationTest::TestLocateSelf() { BGeolocation locator(BUrl( - "https://location.services.mozilla.com/v1/geolocate?key=test"), BUrl()); + "https://location.services.mozilla.com/v1/geolocate?key=test", true), BUrl()); float latitude, longitude; status_t result = locator.LocateSelf(latitude, longitude); @@ -36,7 +36,7 @@ GeolocationTest::TestLocateSelf() void GeolocationTest::TestCountry() { - BGeolocation geocoder(BUrl(""), BUrl("https://secure.geonames.org/?username=demo")); + BGeolocation geocoder(BUrl("", true), BUrl("https://secure.geonames.org/?username=demo", true)); BCountry country; status_t result = geocoder.Country(47.03f, 10.2f, country); CPPUNIT_ASSERT_EQUAL(B_OK, result); diff --git a/src/tests/kits/net/service/HttpTest.cpp b/src/tests/kits/net/service/HttpTest.cpp index 2dc17e90f3..9c1fdb0f2d 100644 --- a/src/tests/kits/net/service/HttpTest.cpp +++ b/src/tests/kits/net/service/HttpTest.cpp @@ -155,12 +155,7 @@ void SendAuthenticatedRequest( // Return the path of a file path relative to this source file. std::string TestFilePath(const std::string& relativePath) { - char *testFileSource = strdup(__FILE__); - MemoryDeleter _(testFileSource); - - std::string testSrcDir(::dirname(testFileSource)); - - return testSrcDir + "/" + relativePath; + return relativePath; } @@ -211,7 +206,7 @@ HttpTest::GetTest() void HttpTest::HeadTest() { - BUrl testUrl(fTestServer.BaseUrl(), "/"); + BUrl testUrl(fTestServer.BaseUrl(), BString("/")); BUrlContext* context = new BUrlContext(); context->AcquireReference(); @@ -259,7 +254,7 @@ HttpTest::HeadTest() void HttpTest::NoContentTest() { - BUrl testUrl(fTestServer.BaseUrl(), "/204"); + BUrl testUrl(fTestServer.BaseUrl(), BString("/204")); BUrlContext* context = new BUrlContext(); context->AcquireReference(); @@ -301,7 +296,7 @@ HttpTest::NoContentTest() void HttpTest::ProxyTest() { - BUrl testUrl(fTestServer.BaseUrl(), "/"); + BUrl testUrl(fTestServer.BaseUrl(), BString("/")); TestProxyServer proxy; CPPUNIT_ASSERT_EQUAL_MESSAGE( @@ -423,7 +418,7 @@ HttpTest::UploadTest() expectedResponseHeaders["Server"] = "Test HTTP Server for Haiku"; TestListener listener(expectedResponseBody, expectedResponseHeaders); - BUrl testUrl(fTestServer.BaseUrl(), "/post"); + BUrl testUrl(fTestServer.BaseUrl(), BString("/post")); BUrlContext context; @@ -463,7 +458,7 @@ HttpTest::AuthBasicTest() { BUrlContext context; - BUrl testUrl(fTestServer.BaseUrl(), "/auth/basic/walter/secret"); + BUrl testUrl(fTestServer.BaseUrl(), BString("/auth/basic/walter/secret")); std::string expectedResponseBody( "Path: /auth/basic/walter/secret\r\n" @@ -499,7 +494,7 @@ HttpTest::AuthDigestTest() { BUrlContext context; - BUrl testUrl(fTestServer.BaseUrl(), "/auth/digest/walter/secret"); + BUrl testUrl(fTestServer.BaseUrl(), BString("/auth/digest/walter/secret")); std::string expectedResponseBody( "Path: /auth/digest/walter/secret\r\n" diff --git a/src/tests/kits/net/service/Jamfile b/src/tests/kits/net/service/Jamfile index 86ee3a9140..529a7cce5c 100644 --- a/src/tests/kits/net/service/Jamfile +++ b/src/tests/kits/net/service/Jamfile @@ -2,6 +2,22 @@ SubDir HAIKU_TOP src tests kits net service ; UsePrivateHeaders netservices private shared ; +AddSubDirSupportedPlatforms libbe_test ; + +rule CopyScript # cloned CopyBAppTestApp +{ + # CopyScript : ; + 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 : ServiceKitTestAddon.cpp @@ -16,3 +32,6 @@ UnitTestLib servicekittest.so : : be libnetservices.a shared $(TARGET_NETWORK_LIBS) $(HAIKU_NETAPI_LIB) [ TargetLibstdc++ ] ; +CopyScript proxy.py : proxy.py ; +CopyScript testserver.py : testserver.py ; +CopyScript testfile.txt : testfile.txt ; diff --git a/src/tests/kits/net/service/TestServer.cpp b/src/tests/kits/net/service/TestServer.cpp index d2551f962a..b993d15ba8 100644 --- a/src/tests/kits/net/service/TestServer.cpp +++ b/src/tests/kits/net/service/TestServer.cpp @@ -49,12 +49,7 @@ void exec(const std::vector& args) // Return the path of a file path relative to this source file. std::string TestFilePath(const std::string& relativePath) { - char *testFileSource = strdup(__FILE__); - MemoryDeleter _(testFileSource); - - std::string testSrcDir(::dirname(testFileSource)); - - return testSrcDir + "/" + relativePath; + return relativePath; } } @@ -279,7 +274,7 @@ BUrl TestServer::BaseUrl() const std::string port_string = to_string(fPort.Port()); std::string baseUrl = scheme + "127.0.0.1:" + port_string + "/"; - return BUrl(baseUrl.c_str()); + return BUrl(baseUrl.c_str(), true); } diff --git a/src/tests/kits/net/service/UrlTest.cpp b/src/tests/kits/net/service/UrlTest.cpp index 7e28f914ee..b874e9bc5c 100644 --- a/src/tests/kits/net/service/UrlTest.cpp +++ b/src/tests/kits/net/service/UrlTest.cpp @@ -54,7 +54,7 @@ void UrlTest::ParseTest() { NextSubTest(); - testUrl.SetUrlString(kTestLength[testIndex]); + testUrl.SetUrlString(kTestLength[testIndex], true); CPPUNIT_ASSERT_EQUAL(BString(kTestLength[testIndex]), testUrl.UrlString()); } @@ -63,14 +63,14 @@ void UrlTest::ParseTest() void UrlTest::TestIsValid() { - BUrl url("http:"); + BUrl url("http:", true); CPPUNIT_ASSERT_MESSAGE("Created with a scheme but no hierarchical segment.", !url.IsValid()); url.SetHost(""); CPPUNIT_ASSERT_MESSAGE("Set to an invalid host", !url.IsValid()); - url.SetUrlString(""); + url.SetUrlString("", true); url.SetProtocol("\t \n"); CPPUNIT_ASSERT_MESSAGE("Set a protocol with whitespace", !url.IsValid()); url.SetProtocol("123"); @@ -144,8 +144,8 @@ void UrlTest::TestNullity() void UrlTest::TestCopy() { - BUrl url1("http://example.com"); - BUrl url2(url1); + BUrl url1("http://example.com", true); + BUrl url2(url1, true); url2.SetHost("www.example.com"); @@ -215,7 +215,7 @@ void UrlTest::ExplodeImplodeTest() for (testIndex = 0; testIndex < (sizeof(kTestExplode) / sizeof(ExplodeTest)); testIndex++) { NextSubTest(); - testUrl.SetUrlString(kTestExplode[testIndex].url); + testUrl.SetUrlString(kTestExplode[testIndex].url, true); CPPUNIT_ASSERT_EQUAL(BString(kTestExplode[testIndex].url), BString(testUrl.UrlString())); @@ -528,7 +528,7 @@ UrlTest::RelativeUriTest() { NextSubTest(); - BUrl baseUrl(tests[index].base); + BUrl baseUrl(tests[index].base, true); message.Truncate(7, true); message << tests[index].base; @@ -596,8 +596,8 @@ UrlTest::IDNTest() { NextSubTest(); - BUrl url(tests[i].escaped); - BUrl idn(tests[i].decoded); + BUrl url(tests[i].escaped, false); + BUrl idn(tests[i].decoded, false); status_t success = idn.IDNAToUnicode(); CPPUNIT_ASSERT_EQUAL(B_OK, success); diff --git a/src/tests/kits/shared/MemoryRingIOTest.cpp b/src/tests/kits/shared/MemoryRingIOTest.cpp index 7efe121d96..957ad4f748 100644 --- a/src/tests/kits/shared/MemoryRingIOTest.cpp +++ b/src/tests/kits/shared/MemoryRingIOTest.cpp @@ -208,16 +208,15 @@ MemoryRingIOTest::AddTests(BTestSuite& parent) { caller->addThread("WR", &MemoryRingIOTest::_DisableWriteOnEmptyBuffer); suite->addTest(caller); - MemoryRingIOTest* single = new MemoryRingIOTest(0); suite->addTest(new CppUnit::TestCaller( "MemoryRingIOTest: RW single threaded with resizing", - &MemoryRingIOTest::ReadWriteSingleTest, single)); + &MemoryRingIOTest::ReadWriteSingleTest, new MemoryRingIOTest(0))); suite->addTest(new CppUnit::TestCaller( "MemoryRingIOTest: Attempt to truncate buffer", - &MemoryRingIOTest::InvalidResizeTest, single)); + &MemoryRingIOTest::InvalidResizeTest, new MemoryRingIOTest(0))); suite->addTest(new CppUnit::TestCaller( "MemoryRingIOTest: Wait timeout", - &MemoryRingIOTest::TimeoutTest, single)); + &MemoryRingIOTest::TimeoutTest, new MemoryRingIOTest(0))); parent.addTest("MemoryRingIOTest", suite); } diff --git a/src/tests/kits/storage/AppFileInfoTest.cpp b/src/tests/kits/storage/AppFileInfoTest.cpp index a8878d53a0..bb6e1215f0 100644 --- a/src/tests/kits/storage/AppFileInfoTest.cpp +++ b/src/tests/kits/storage/AppFileInfoTest.cpp @@ -2046,6 +2046,7 @@ AppFileInfoTest::IconTest() SyncResources(appFileInfo); CheckIconResource(file, fIconL2); } +#if 0 // * bitmap color_space != B_CMAP8 => B_OK NextSubTest(); { @@ -2070,6 +2071,7 @@ AppFileInfoTest::IconTest() CHK(icon_equal(&icon3, &icon4)); #endif } +#endif // status_t SetIcon(const BBitmap *icon, icon_size k) // * NULL icon => unsets icon, B_OK @@ -2410,6 +2412,7 @@ AppFileInfoTest::IconForTypeTest() SyncResources(appFileInfo); CheckIconForTypeResource(file, testType1, fIconL2); } +#if 0 // * bitmap color_space != B_CMAP8 => B_OK NextSubTest(); { @@ -2435,6 +2438,7 @@ AppFileInfoTest::IconForTypeTest() CHK(icon_equal(&icon3, &icon4)); #endif } +#endif // status_t SetIconForType(const char *type, const BBitmap *icon, // icon_size which) diff --git a/src/tests/kits/translation/TranslatorRosterTest.cpp b/src/tests/kits/translation/TranslatorRosterTest.cpp index e4c8fd260b..522fad7cd9 100644 --- a/src/tests/kits/translation/TranslatorRosterTest.cpp +++ b/src/tests/kits/translation/TranslatorRosterTest.cpp @@ -945,10 +945,11 @@ TranslatorRosterTest::MakeConfigurationViewTest() &extent) == B_NO_TRANSLATOR); // should work - NextSubTest(); - CPPUNIT_ASSERT(pDefRoster->MakeConfigurationView(translators[0], NULL, - &view, &extent) == B_OK); - CPPUNIT_ASSERT(extent.IsValid() == true); +// crash: you need to have valid app_server connection first +// NextSubTest(); +// CPPUNIT_ASSERT(pDefRoster->MakeConfigurationView(translators[0], NULL, +// &view, &extent) == B_OK); +// CPPUNIT_ASSERT(extent.IsValid() == true); // TODO: Add a test that uses a valid BMessage with actual settings in it diff --git a/src/tests/servers/launch/Jamfile b/src/tests/servers/launch/Jamfile index b59df173c2..96a0b3adaa 100644 --- a/src/tests/servers/launch/Jamfile +++ b/src/tests/servers/launch/Jamfile @@ -1,7 +1,5 @@ SubDir HAIKU_TOP src tests servers launch ; -SubInclude HAIKU_TOP src tests servers launch tools ; - AddSubDirSupportedPlatforms libbe_test ; UsePrivateHeaders app kernel libroot shared storage support ; @@ -29,3 +27,4 @@ UnitTestLib liblaunch_daemontest.so : : be network bnetapi shared [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; +SubInclude HAIKU_TOP src tests servers launch tools ; diff --git a/src/tests/system/kernel/util/BOpenHashTableTest.cpp b/src/tests/system/kernel/util/BOpenHashTableTest.cpp index acc7623cb1..a92cb7d745 100644 --- a/src/tests/system/kernel/util/BOpenHashTableTest.cpp +++ b/src/tests/system/kernel/util/BOpenHashTableTest.cpp @@ -161,7 +161,7 @@ void BOpenHashTableTest::InsertUncheckedUninitializedTest() void BOpenHashTableTest::IterateAndCountTest() { const size_t kEntryCount = 20; - BObjectList entries(20, true); + BObjectList entries(20); BOpenHashTable table; CPPUNIT_ASSERT_EQUAL(table.Init(kEntryCount * 2), B_OK); @@ -191,7 +191,7 @@ void BOpenHashTableTest::ResizeTest() // This is the same as IterateAndCountTest, except that the table will // be resized mid insertion. const size_t kEntryCount = 20; - BObjectList entries(20, true); + BObjectList entries(20); BOpenHashTable table; // Start off with capacity for 8 elements. This will mean that the table @@ -341,7 +341,7 @@ void BOpenHashTableTest::ClearTest() { const size_t kEntryCount = 3; - BObjectList entries(20, true); + BObjectList entries(20); BOpenHashTable table; CPPUNIT_ASSERT_EQUAL(table.Init(), B_OK); diff --git a/src/tests/system/kernel/util/Jamfile b/src/tests/system/kernel/util/Jamfile index eda5640e40..3a2d9945cb 100644 --- a/src/tests/system/kernel/util/Jamfile +++ b/src/tests/system/kernel/util/Jamfile @@ -4,6 +4,7 @@ AddSubDirSupportedPlatforms libbe_test ; UsePrivateHeaders [ FDirName kernel util ] ; UsePrivateHeaders [ FDirName kernel ] ; +UsePrivateHeaders [ FDirName util ] ; UseHeaders [ FDirName $(HAIKU_TOP) src tests kits app ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src system kernel util ] ; diff --git a/src/tests/system/kernel/util/SinglyLinkedListTest.cpp b/src/tests/system/kernel/util/SinglyLinkedListTest.cpp index ef9ae056b0..83c9db5afb 100644 --- a/src/tests/system/kernel/util/SinglyLinkedListTest.cpp +++ b/src/tests/system/kernel/util/SinglyLinkedListTest.cpp @@ -58,14 +58,14 @@ SinglyLinkedListTest::TestList(List &list, Element *values, int valueCount) // PushFront for (int i = 0; i < valueCount; i++) { NextSubTest(); - CHK(list.Size() == i); + CHK(list.Count() == i); list.Add(&values[i]); - CHK(list.Size() == i+1); + CHK(list.Count() == i+1); } // Prefix increment int preIndex = valueCount-1; - for (typename List::Iterator iterator = list.GetIterator(); + for (typename List::ConstIterator iterator = list.GetIterator(); iterator.HasNext(); --preIndex) { NextSubTest();