diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-05-25 19:10:27 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-05-30 15:29:51 +0000 |
commit | 8a7beb631787bbc61624f0fead0563b35649be3a (patch) | |
tree | 58b45d4c54238b67399b09d4831c8ced945df2a9 /tests | |
parent | b13a5e2a07764dbf92736a2c89e65af0d26c4556 (diff) |
Migrate tests of Apple platforms/tools into new tst_blackboxapple target
This new test suite collects all the tests which test qbs' support for
Apple platforms, Xcode, and related tools.
Change-Id: I835e2d5bee46f1b4bb281c02b5b4ef814f196d7c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 1 | ||||
-rw-r--r-- | tests/auto/auto.qbs | 1 | ||||
-rw-r--r-- | tests/auto/blackbox/blackbox-apple.pro | 19 | ||||
-rw-r--r-- | tests/auto/blackbox/blackbox-apple.qbs | 23 | ||||
-rw-r--r-- | tests/auto/blackbox/blackbox.qbs | 1 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/apple-multiconfig/app.c (renamed from tests/auto/blackbox/testdata/apple-multiconfig/app.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs (renamed from tests/auto/blackbox/testdata/apple-multiconfig/apple-multiconfig.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/apple-multiconfig/lib.c (renamed from tests/auto/blackbox/testdata/apple-multiconfig/lib.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs (renamed from tests/auto/blackbox/testdata/bundle-structure/bundle-structure.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/bundle-structure/dummy.c (renamed from tests/auto/blackbox/testdata/bundle-structure/dummy.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/bundle-structure/dummy.h (renamed from tests/auto/blackbox/testdata/bundle-structure/dummy.h) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/bundle-structure/dummy_p.h (renamed from tests/auto/blackbox/testdata/bundle-structure/dummy_p.h) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/bundle-structure/resource.txt (renamed from tests/auto/blackbox/testdata/bundle-structure/resource.txt) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/deploymentTarget/deployment.qbs (renamed from tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/deploymentTarget/main.c (renamed from tests/auto/blackbox/testdata/deploymentTarget/main.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/embedInfoPlist/embedInfoPlist.qbs (renamed from tests/auto/blackbox/testdata/embedInfoPlist/embedInfoPlist.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/embedInfoPlist/main.m (renamed from tests/auto/blackbox/testdata/embedInfoPlist/main.m) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/frameworkStructure/BaseResource (renamed from tests/auto/blackbox/testdata/frameworkStructure/BaseResource) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/frameworkStructure/Widget.cpp (renamed from tests/auto/blackbox/testdata/frameworkStructure/Widget.cpp) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/frameworkStructure/Widget.h (renamed from tests/auto/blackbox/testdata/frameworkStructure/Widget.h) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/frameworkStructure/WidgetPrivate.h (renamed from tests/auto/blackbox/testdata/frameworkStructure/WidgetPrivate.h) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/frameworkStructure/en.lproj/EnglishResource (renamed from tests/auto/blackbox/testdata/frameworkStructure/en.lproj/EnglishResource) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/frameworkStructure/frameworkStructure.qbs (renamed from tests/auto/blackbox/testdata/frameworkStructure/frameworkStructure.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/EmptyStoryboard.storyboard (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/EmptyStoryboard.storyboard) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/MainMenu.xib (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/MainMenu.xib) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/Storyboard.storyboard (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/Storyboard.storyboard) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/assetcatalogempty.qbs (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/assetcatalogempty.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16.png (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16.png) | bin | 649 -> 649 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16@2x.png (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16@2x.png) | bin | 665 -> 665 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/Contents.json (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/Contents.json) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16.png (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16.png) | bin | 649 -> 649 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16@2x.png (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16@2x.png) | bin | 665 -> 665 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/assetcatalog/main.c (renamed from tests/auto/blackbox/testdata/ib/assetcatalog/main.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog1.xcassets/.keep (renamed from tests/auto/blackbox/testdata/ib/empty-asset-catalogs/assetcatalog1.xcassets/.keep) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog2.xcassets/.keep (renamed from tests/auto/blackbox/testdata/ib/empty-asset-catalogs/assetcatalog2.xcassets/.keep) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/main.c (renamed from tests/auto/blackbox/testdata/ib/empty-asset-catalogs/main.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/multiple-asset-catalogs.qbs (renamed from tests/auto/blackbox/testdata/ib/empty-asset-catalogs/multiple-asset-catalogs.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/iconset/iconset.qbs (renamed from tests/auto/blackbox/testdata/ib/iconset/iconset.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/icon_16x16.png (renamed from tests/auto/blackbox/testdata/ib/iconset/white.iconset/icon_16x16.png) | bin | 649 -> 649 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/icon_16x16@2x.png (renamed from tests/auto/blackbox/testdata/ib/iconset/white.iconset/icon_16x16@2x.png) | bin | 665 -> 665 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/iconsetapp/iconsetapp.qbs (renamed from tests/auto/blackbox/testdata/ib/iconsetapp/iconsetapp.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/iconsetapp/main.c (renamed from tests/auto/blackbox/testdata/ib/iconsetapp/main.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/icon_16x16.png (renamed from tests/auto/blackbox/testdata/ib/iconsetapp/white.iconset/icon_16x16.png) | bin | 649 -> 649 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/icon_16x16@2x.png (renamed from tests/auto/blackbox/testdata/ib/iconsetapp/white.iconset/icon_16x16@2x.png) | bin | 665 -> 665 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/Contents.json (renamed from tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/Contents.json) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16.png (renamed from tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16.png) | bin | 649 -> 649 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16@2x.png (renamed from tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16@2x.png) | bin | 665 -> 665 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/Contents.json (renamed from tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/Contents.json) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16.png (renamed from tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16.png) | bin | 649 -> 649 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16@2x.png (renamed from tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16@2x.png) | bin | 665 -> 665 bytes | |||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/main.c (renamed from tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/main.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/multiple-asset-catalogs.qbs (renamed from tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/multiple-asset-catalogs.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/infoplist/infoplist.qbs (renamed from tests/auto/blackbox/testdata/infoplist/infoplist.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/infoplist/main.c (renamed from tests/auto/blackbox/testdata/infoplist/main.c) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/objc-arc/arc.m (renamed from tests/auto/blackbox/testdata/objc-arc/arc.m) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/objc-arc/arc.mm (renamed from tests/auto/blackbox/testdata/objc-arc/arc.mm) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/objc-arc/main.m (renamed from tests/auto/blackbox/testdata/objc-arc/main.m) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/objc-arc/mrc.m (renamed from tests/auto/blackbox/testdata/objc-arc/mrc.m) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/objc-arc/mrc.mm (renamed from tests/auto/blackbox/testdata/objc-arc/mrc.mm) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/objc-arc/objc-arc.qbs (renamed from tests/auto/blackbox/testdata/objc-arc/objc-arc.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs (renamed from tests/auto/blackbox/testdata/xcode/xcode-project.qbs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 712 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 14 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxapple.cpp | 729 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxapple.h | 61 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxbase.h | 2 |
66 files changed, 835 insertions, 728 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index e660c058a..c46f0c260 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -10,6 +10,7 @@ qbs_enable_unit_tests { SUBDIRS += \ cmdlineparser \ blackbox/blackbox.pro \ + blackbox/blackbox-apple.pro \ blackbox/blackbox-clangdb.pro \ blackbox/blackbox-java.pro \ blackbox/blackbox-qt.pro \ diff --git a/tests/auto/auto.qbs b/tests/auto/auto.qbs index bddfa2c6b..6f20daeb5 100644 --- a/tests/auto/auto.qbs +++ b/tests/auto/auto.qbs @@ -5,6 +5,7 @@ Project { references: [ "api/api.qbs", "blackbox/blackbox.qbs", + "blackbox/blackbox-apple.qbs", "blackbox/blackbox-qt.qbs", "buildgraph/buildgraph.qbs", "cmdlineparser/cmdlineparser.qbs", diff --git a/tests/auto/blackbox/blackbox-apple.pro b/tests/auto/blackbox/blackbox-apple.pro new file mode 100644 index 000000000..51747e5b3 --- /dev/null +++ b/tests/auto/blackbox/blackbox-apple.pro @@ -0,0 +1,19 @@ +TARGET = tst_blackbox-apple + +HEADERS = tst_blackboxapple.h tst_blackboxbase.h +SOURCES = tst_blackboxapple.cpp tst_blackboxbase.cpp +OBJECTS_DIR = apple + +include(../auto.pri) + +QT += xml + +DATA_DIRS = testdata-apple ../find + +for(data_dir, DATA_DIRS) { + files = $$files($$PWD/$$data_dir/*, true) + win32:files ~= s|\\\\|/|g + for(file, files):!exists($$file/*):FILES += $$file +} + +OTHER_FILES += $$FILES diff --git a/tests/auto/blackbox/blackbox-apple.qbs b/tests/auto/blackbox/blackbox-apple.qbs new file mode 100644 index 000000000..34b7e372d --- /dev/null +++ b/tests/auto/blackbox/blackbox-apple.qbs @@ -0,0 +1,23 @@ +import qbs + +QbsAutotest { + testName: "blackbox-apple" + Depends { name: "Qt.xml" } + Depends { name: "qbs_app" } + Depends { name: "qbs-setup-toolchains" } + Group { + name: "testdata" + prefix: "testdata-apple/" + files: ["**/*"] + fileTags: [] + } + files: [ + "../shared.h", + "tst_blackboxapple.cpp", + "tst_blackboxapple.h", + "tst_blackboxbase.cpp", + "tst_blackboxbase.h", + ] + // TODO: Use Utilities.cStringQuote + cpp.defines: base.concat(['SRCDIR="' + path + '"']) +} diff --git a/tests/auto/blackbox/blackbox.qbs b/tests/auto/blackbox/blackbox.qbs index 7ae40e471..b56cf4111 100644 --- a/tests/auto/blackbox/blackbox.qbs +++ b/tests/auto/blackbox/blackbox.qbs @@ -5,7 +5,6 @@ Project { QbsAutotest { testName: "blackbox" - Depends { name: "Qt.xml" } Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { diff --git a/tests/auto/blackbox/testdata/apple-multiconfig/app.c b/tests/auto/blackbox/testdata-apple/apple-multiconfig/app.c index d0bb0c43c..d0bb0c43c 100644 --- a/tests/auto/blackbox/testdata/apple-multiconfig/app.c +++ b/tests/auto/blackbox/testdata-apple/apple-multiconfig/app.c diff --git a/tests/auto/blackbox/testdata/apple-multiconfig/apple-multiconfig.qbs b/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs index a974e93e5..a974e93e5 100644 --- a/tests/auto/blackbox/testdata/apple-multiconfig/apple-multiconfig.qbs +++ b/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs diff --git a/tests/auto/blackbox/testdata/apple-multiconfig/lib.c b/tests/auto/blackbox/testdata-apple/apple-multiconfig/lib.c index 37dc6f016..37dc6f016 100644 --- a/tests/auto/blackbox/testdata/apple-multiconfig/lib.c +++ b/tests/auto/blackbox/testdata-apple/apple-multiconfig/lib.c diff --git a/tests/auto/blackbox/testdata/bundle-structure/bundle-structure.qbs b/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs index a7c3e20bf..a7c3e20bf 100644 --- a/tests/auto/blackbox/testdata/bundle-structure/bundle-structure.qbs +++ b/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs diff --git a/tests/auto/blackbox/testdata/bundle-structure/dummy.c b/tests/auto/blackbox/testdata-apple/bundle-structure/dummy.c index 210c8274e..210c8274e 100644 --- a/tests/auto/blackbox/testdata/bundle-structure/dummy.c +++ b/tests/auto/blackbox/testdata-apple/bundle-structure/dummy.c diff --git a/tests/auto/blackbox/testdata/bundle-structure/dummy.h b/tests/auto/blackbox/testdata-apple/bundle-structure/dummy.h index 50841a226..50841a226 100644 --- a/tests/auto/blackbox/testdata/bundle-structure/dummy.h +++ b/tests/auto/blackbox/testdata-apple/bundle-structure/dummy.h diff --git a/tests/auto/blackbox/testdata/bundle-structure/dummy_p.h b/tests/auto/blackbox/testdata-apple/bundle-structure/dummy_p.h index 50841a226..50841a226 100644 --- a/tests/auto/blackbox/testdata/bundle-structure/dummy_p.h +++ b/tests/auto/blackbox/testdata-apple/bundle-structure/dummy_p.h diff --git a/tests/auto/blackbox/testdata/bundle-structure/resource.txt b/tests/auto/blackbox/testdata-apple/bundle-structure/resource.txt index e69de29bb..e69de29bb 100644 --- a/tests/auto/blackbox/testdata/bundle-structure/resource.txt +++ b/tests/auto/blackbox/testdata-apple/bundle-structure/resource.txt diff --git a/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs b/tests/auto/blackbox/testdata-apple/deploymentTarget/deployment.qbs index f805de67c..f805de67c 100644 --- a/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs +++ b/tests/auto/blackbox/testdata-apple/deploymentTarget/deployment.qbs diff --git a/tests/auto/blackbox/testdata/deploymentTarget/main.c b/tests/auto/blackbox/testdata-apple/deploymentTarget/main.c index 210c8274e..210c8274e 100644 --- a/tests/auto/blackbox/testdata/deploymentTarget/main.c +++ b/tests/auto/blackbox/testdata-apple/deploymentTarget/main.c diff --git a/tests/auto/blackbox/testdata/embedInfoPlist/embedInfoPlist.qbs b/tests/auto/blackbox/testdata-apple/embedInfoPlist/embedInfoPlist.qbs index 93d94c66b..93d94c66b 100644 --- a/tests/auto/blackbox/testdata/embedInfoPlist/embedInfoPlist.qbs +++ b/tests/auto/blackbox/testdata-apple/embedInfoPlist/embedInfoPlist.qbs diff --git a/tests/auto/blackbox/testdata/embedInfoPlist/main.m b/tests/auto/blackbox/testdata-apple/embedInfoPlist/main.m index b3f362223..b3f362223 100644 --- a/tests/auto/blackbox/testdata/embedInfoPlist/main.m +++ b/tests/auto/blackbox/testdata-apple/embedInfoPlist/main.m diff --git a/tests/auto/blackbox/testdata/frameworkStructure/BaseResource b/tests/auto/blackbox/testdata-apple/frameworkStructure/BaseResource index e69de29bb..e69de29bb 100644 --- a/tests/auto/blackbox/testdata/frameworkStructure/BaseResource +++ b/tests/auto/blackbox/testdata-apple/frameworkStructure/BaseResource diff --git a/tests/auto/blackbox/testdata/frameworkStructure/Widget.cpp b/tests/auto/blackbox/testdata-apple/frameworkStructure/Widget.cpp index e17b96750..e17b96750 100644 --- a/tests/auto/blackbox/testdata/frameworkStructure/Widget.cpp +++ b/tests/auto/blackbox/testdata-apple/frameworkStructure/Widget.cpp diff --git a/tests/auto/blackbox/testdata/frameworkStructure/Widget.h b/tests/auto/blackbox/testdata-apple/frameworkStructure/Widget.h index e5dacdb56..e5dacdb56 100644 --- a/tests/auto/blackbox/testdata/frameworkStructure/Widget.h +++ b/tests/auto/blackbox/testdata-apple/frameworkStructure/Widget.h diff --git a/tests/auto/blackbox/testdata/frameworkStructure/WidgetPrivate.h b/tests/auto/blackbox/testdata-apple/frameworkStructure/WidgetPrivate.h index 50841a226..50841a226 100644 --- a/tests/auto/blackbox/testdata/frameworkStructure/WidgetPrivate.h +++ b/tests/auto/blackbox/testdata-apple/frameworkStructure/WidgetPrivate.h diff --git a/tests/auto/blackbox/testdata/frameworkStructure/en.lproj/EnglishResource b/tests/auto/blackbox/testdata-apple/frameworkStructure/en.lproj/EnglishResource index e69de29bb..e69de29bb 100644 --- a/tests/auto/blackbox/testdata/frameworkStructure/en.lproj/EnglishResource +++ b/tests/auto/blackbox/testdata-apple/frameworkStructure/en.lproj/EnglishResource diff --git a/tests/auto/blackbox/testdata/frameworkStructure/frameworkStructure.qbs b/tests/auto/blackbox/testdata-apple/frameworkStructure/frameworkStructure.qbs index 39b3a1b58..39b3a1b58 100644 --- a/tests/auto/blackbox/testdata/frameworkStructure/frameworkStructure.qbs +++ b/tests/auto/blackbox/testdata-apple/frameworkStructure/frameworkStructure.qbs diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/EmptyStoryboard.storyboard b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/EmptyStoryboard.storyboard index 71b6b6857..71b6b6857 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/EmptyStoryboard.storyboard +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/EmptyStoryboard.storyboard diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/MainMenu.xib b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/MainMenu.xib index 14312411a..14312411a 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/MainMenu.xib +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/MainMenu.xib diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/Storyboard.storyboard b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/Storyboard.storyboard index 41510ae29..41510ae29 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/Storyboard.storyboard +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/Storyboard.storyboard diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/assetcatalogempty.qbs b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/assetcatalogempty.qbs index e79d0dd18..e79d0dd18 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/assetcatalogempty.qbs +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/assetcatalogempty.qbs diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16.png b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16.png Binary files differindex 60365798f..60365798f 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16.png +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16.png diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16@2x.png b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16@2x.png Binary files differindex 20369000d..20369000d 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16@2x.png +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16@2x.png diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/Contents.json b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/Contents.json index 4b1cfb1f0..4b1cfb1f0 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/Contents.json +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/Contents.json diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16.png b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16.png Binary files differindex 60365798f..60365798f 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16.png +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16.png diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16@2x.png b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16@2x.png Binary files differindex 20369000d..20369000d 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16@2x.png +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16@2x.png diff --git a/tests/auto/blackbox/testdata/ib/assetcatalog/main.c b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/main.c index ed95605b3..ed95605b3 100644 --- a/tests/auto/blackbox/testdata/ib/assetcatalog/main.c +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/main.c diff --git a/tests/auto/blackbox/testdata/ib/empty-asset-catalogs/assetcatalog1.xcassets/.keep b/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog1.xcassets/.keep index e69de29bb..e69de29bb 100644 --- a/tests/auto/blackbox/testdata/ib/empty-asset-catalogs/assetcatalog1.xcassets/.keep +++ b/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog1.xcassets/.keep diff --git a/tests/auto/blackbox/testdata/ib/empty-asset-catalogs/assetcatalog2.xcassets/.keep b/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog2.xcassets/.keep index e69de29bb..e69de29bb 100644 --- a/tests/auto/blackbox/testdata/ib/empty-asset-catalogs/assetcatalog2.xcassets/.keep +++ b/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog2.xcassets/.keep diff --git a/tests/auto/blackbox/testdata/ib/empty-asset-catalogs/main.c b/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/main.c index 210c8274e..210c8274e 100644 --- a/tests/auto/blackbox/testdata/ib/empty-asset-catalogs/main.c +++ b/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/main.c diff --git a/tests/auto/blackbox/testdata/ib/empty-asset-catalogs/multiple-asset-catalogs.qbs b/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/multiple-asset-catalogs.qbs index 454d3c482..454d3c482 100644 --- a/tests/auto/blackbox/testdata/ib/empty-asset-catalogs/multiple-asset-catalogs.qbs +++ b/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/multiple-asset-catalogs.qbs diff --git a/tests/auto/blackbox/testdata/ib/iconset/iconset.qbs b/tests/auto/blackbox/testdata-apple/ib/iconset/iconset.qbs index 1d563f180..1d563f180 100644 --- a/tests/auto/blackbox/testdata/ib/iconset/iconset.qbs +++ b/tests/auto/blackbox/testdata-apple/ib/iconset/iconset.qbs diff --git a/tests/auto/blackbox/testdata/ib/iconset/white.iconset/icon_16x16.png b/tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/icon_16x16.png Binary files differindex 60365798f..60365798f 100644 --- a/tests/auto/blackbox/testdata/ib/iconset/white.iconset/icon_16x16.png +++ b/tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/icon_16x16.png diff --git a/tests/auto/blackbox/testdata/ib/iconset/white.iconset/icon_16x16@2x.png b/tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/icon_16x16@2x.png Binary files differindex 20369000d..20369000d 100644 --- a/tests/auto/blackbox/testdata/ib/iconset/white.iconset/icon_16x16@2x.png +++ b/tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/icon_16x16@2x.png diff --git a/tests/auto/blackbox/testdata/ib/iconsetapp/iconsetapp.qbs b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/iconsetapp.qbs index 7e5323a0c..7e5323a0c 100644 --- a/tests/auto/blackbox/testdata/ib/iconsetapp/iconsetapp.qbs +++ b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/iconsetapp.qbs diff --git a/tests/auto/blackbox/testdata/ib/iconsetapp/main.c b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/main.c index ed95605b3..ed95605b3 100644 --- a/tests/auto/blackbox/testdata/ib/iconsetapp/main.c +++ b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/main.c diff --git a/tests/auto/blackbox/testdata/ib/iconsetapp/white.iconset/icon_16x16.png b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/icon_16x16.png Binary files differindex 60365798f..60365798f 100644 --- a/tests/auto/blackbox/testdata/ib/iconsetapp/white.iconset/icon_16x16.png +++ b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/icon_16x16.png diff --git a/tests/auto/blackbox/testdata/ib/iconsetapp/white.iconset/icon_16x16@2x.png b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/icon_16x16@2x.png Binary files differindex 20369000d..20369000d 100644 --- a/tests/auto/blackbox/testdata/ib/iconsetapp/white.iconset/icon_16x16@2x.png +++ b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/icon_16x16@2x.png diff --git a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/Contents.json b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/Contents.json index 4b1cfb1f0..4b1cfb1f0 100644 --- a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/Contents.json +++ b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/Contents.json diff --git a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16.png b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16.png Binary files differindex 60365798f..60365798f 100644 --- a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16.png +++ b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16.png diff --git a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16@2x.png b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16@2x.png Binary files differindex 20369000d..20369000d 100644 --- a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16@2x.png +++ b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16@2x.png diff --git a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/Contents.json b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/Contents.json index 4b1cfb1f0..4b1cfb1f0 100644 --- a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/Contents.json +++ b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/Contents.json diff --git a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16.png b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16.png Binary files differindex 60365798f..60365798f 100644 --- a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16.png +++ b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16.png diff --git a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16@2x.png b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16@2x.png Binary files differindex 20369000d..20369000d 100644 --- a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16@2x.png +++ b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16@2x.png diff --git a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/main.c b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/main.c index 210c8274e..210c8274e 100644 --- a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/main.c +++ b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/main.c diff --git a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/multiple-asset-catalogs.qbs b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/multiple-asset-catalogs.qbs index 454d3c482..454d3c482 100644 --- a/tests/auto/blackbox/testdata/ib/multiple-asset-catalogs/multiple-asset-catalogs.qbs +++ b/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/multiple-asset-catalogs.qbs diff --git a/tests/auto/blackbox/testdata/infoplist/infoplist.qbs b/tests/auto/blackbox/testdata-apple/infoplist/infoplist.qbs index 58cb361dd..58cb361dd 100644 --- a/tests/auto/blackbox/testdata/infoplist/infoplist.qbs +++ b/tests/auto/blackbox/testdata-apple/infoplist/infoplist.qbs diff --git a/tests/auto/blackbox/testdata/infoplist/main.c b/tests/auto/blackbox/testdata-apple/infoplist/main.c index 210c8274e..210c8274e 100644 --- a/tests/auto/blackbox/testdata/infoplist/main.c +++ b/tests/auto/blackbox/testdata-apple/infoplist/main.c diff --git a/tests/auto/blackbox/testdata/objc-arc/arc.m b/tests/auto/blackbox/testdata-apple/objc-arc/arc.m index 6d8e22f09..6d8e22f09 100644 --- a/tests/auto/blackbox/testdata/objc-arc/arc.m +++ b/tests/auto/blackbox/testdata-apple/objc-arc/arc.m diff --git a/tests/auto/blackbox/testdata/objc-arc/arc.mm b/tests/auto/blackbox/testdata-apple/objc-arc/arc.mm index 6d8e22f09..6d8e22f09 100644 --- a/tests/auto/blackbox/testdata/objc-arc/arc.mm +++ b/tests/auto/blackbox/testdata-apple/objc-arc/arc.mm diff --git a/tests/auto/blackbox/testdata/objc-arc/main.m b/tests/auto/blackbox/testdata-apple/objc-arc/main.m index 071c53c9f..071c53c9f 100644 --- a/tests/auto/blackbox/testdata/objc-arc/main.m +++ b/tests/auto/blackbox/testdata-apple/objc-arc/main.m diff --git a/tests/auto/blackbox/testdata/objc-arc/mrc.m b/tests/auto/blackbox/testdata-apple/objc-arc/mrc.m index 1d907b5bf..1d907b5bf 100644 --- a/tests/auto/blackbox/testdata/objc-arc/mrc.m +++ b/tests/auto/blackbox/testdata-apple/objc-arc/mrc.m diff --git a/tests/auto/blackbox/testdata/objc-arc/mrc.mm b/tests/auto/blackbox/testdata-apple/objc-arc/mrc.mm index 1d907b5bf..1d907b5bf 100644 --- a/tests/auto/blackbox/testdata/objc-arc/mrc.mm +++ b/tests/auto/blackbox/testdata-apple/objc-arc/mrc.mm diff --git a/tests/auto/blackbox/testdata/objc-arc/objc-arc.qbs b/tests/auto/blackbox/testdata-apple/objc-arc/objc-arc.qbs index 672de3cb5..672de3cb5 100644 --- a/tests/auto/blackbox/testdata/objc-arc/objc-arc.qbs +++ b/tests/auto/blackbox/testdata-apple/objc-arc/objc-arc.qbs diff --git a/tests/auto/blackbox/testdata/xcode/xcode-project.qbs b/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs index 0c2b0b93d..0c2b0b93d 100644 --- a/tests/auto/blackbox/testdata/xcode/xcode-project.qbs +++ b/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 32e6a8c1d..71acd1776 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -45,8 +45,6 @@ #include <QtCore/qtemporarydir.h> #include <QtCore/qtemporaryfile.h> -#include <QtXml/qdom.h> - #include <functional> #include <regex> @@ -55,15 +53,6 @@ using qbs::Internal::HostOsInfo; using qbs::Profile; -class QFileInfo2 : public QFileInfo { -public: - QFileInfo2(const QString &path) : QFileInfo(path) { } - bool isRegularFile() const { return isFile() && !isSymLink(); } - bool isRegularDir() const { return isDir() && !isSymLink(); } - bool isFileSymLink() const { return isFile() && isSymLink(); } - bool isDirSymLink() const { return isDir() && isSymLink(); } -}; - class MacosTarHealer { public: MacosTarHealer() { @@ -150,13 +139,6 @@ QString TestBlackbox::findArchiver(const QString &fileName, int *status) return binary; } -static bool isXcodeProfile(const QString &profileName) -{ - const SettingsPtr s = settings(); - qbs::Profile profile(profileName, s.get()); - return profile.value("qbs.toolchain").toStringList().contains("xcode"); -} - void TestBlackbox::sevenZip() { QDir::setCurrent(testDataDir + "/archiver"); @@ -335,70 +317,6 @@ void TestBlackbox::alwaysRun_data() QTest::newRow("Rule") << "rule.qbs"; } -void TestBlackbox::appleMultiConfig() -{ - if (!HostOsInfo::isMacosHost()) - QSKIP("only applies on macOS"); - - QDir::setCurrent(testDataDir + "/apple-multiconfig"); - QCOMPARE(runQbs(), 0); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/MacOS/singleapp").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/PkgInfo").isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/MacOS/singleapp_agg").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/PkgInfo").isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/singlelib").isFileSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Resources").isDirSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/singlelib").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/Current").isDirSymLink()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/PkgInfo").isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/MacOS/fatmultiapp").isFileSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/MacOS/fatmultiapp_debug").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/PkgInfo").isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib").isFileSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Resources").isDirSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_debug").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_profile").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/Current").isDirSymLink()); - - for (const QString &variant : { "release", "debug", "profile" }) { - for (const QString &arch : { "x86_64" }) { - QProcess process; - process.setProgram("/usr/bin/arch"); - process.setArguments({ - "-arch", arch, - "-e", "DYLD_IMAGE_SUFFIX=_" + variant, - defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp" - }); - process.start(); - process.waitForFinished(); - QCOMPARE(process.exitCode(), 0); - const auto processStdout = process.readAllStandardOutput(); - QVERIFY2(processStdout.contains("Hello from " + variant.toUtf8() + " " + arch.toUtf8()), - processStdout.constData()); - } - } -} - void TestBlackbox::artifactScanning() { const QString projectDir = testDataDir + "/artifact-scanning"; @@ -533,239 +451,6 @@ void TestBlackbox::buildDirectories() QVERIFY2(outputLines.contains(projectDir), m_qbsStdout.constData()); } -void TestBlackbox::bundleStructure() -{ - if (!HostOsInfo::isMacosHost()) - QSKIP("only applies on macOS"); - - QFETCH(QString, productName); - QFETCH(QString, productTypeIdentifier); - QFETCH(bool, isShallow); - - QDir::setCurrent(testDataDir + "/bundle-structure"); - QbsRunParameters params; - params.arguments << "project.buildableProducts:" + productName; - if (isShallow) { - // Coerce shallow bundles - don't set bundle.isShallow directly because we want to test the - // automatic detection - params.arguments - << "qbs.targetOS:ios,darwin,bsd,unix" - << "qbs.architectures:arm64"; - } - - if (productName == "ABadApple" || productName == "ABadThirdParty") - params.expectFailure = true; - - rmDirR(relativeBuildDir()); - const int status = runQbs(params); - if (status != 0) { - QVERIFY2(m_qbsStderr.contains("Bundle product type " - + productTypeIdentifier.toLatin1() - + " is not supported."), - m_qbsStderr.constData()); - return; - } - - QCOMPARE(status, 0); - - if (!isShallow) { - if (productName == "A") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/MacOS").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/MacOS/A").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/PkgInfo").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Resources/resource.txt").isRegularFile()); - } - - if (productName == "B") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/B").isFileSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers").isDirSymLink()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules").isDirSymLink()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/B.framework/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders").isDirSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Resources").isDirSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/B").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Headers").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Headers/dummy.h").isRegularFile()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Modules").isRegularDir()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Modules/module.modulemap").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/PrivateHeaders").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/PrivateHeaders/dummy_p.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Resources/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/Current").isDirSymLink()); - } - - if (productName == "C") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/C").isFileSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers").isDirSymLink()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules").isDirSymLink()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/C.framework/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders").isDirSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Resources").isDirSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/C").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Headers").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Headers/dummy.h").isRegularFile()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Modules").isRegularDir()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Modules/module.modulemap").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/PrivateHeaders").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/PrivateHeaders/dummy_p.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Resources/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/Current").isDirSymLink()); - } - - if (productName == "D") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/MacOS").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/MacOS/D").isRegularFile()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Resources/resource.txt").isRegularFile()); - } - - if (productName == "E") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/MacOS").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/MacOS/E").isRegularFile()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/E.appex/Contents/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Resources/resource.txt").isRegularFile()); - } - - if (productName == "F") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/MacOS").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/MacOS/F").isRegularFile()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Resources/resource.txt").isRegularFile()); - } - - if (productName == "G") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/G").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/G/ContentInfo.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/G/Contents/resource.txt").isRegularFile()); - } - } else { - if (productName == "A") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/A").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/PkgInfo").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/resource.txt").isRegularFile()); - } - - if (productName == "B") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/B").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers/dummy.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Info.plist").isRegularFile()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules").isRegularDir()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules/module.modulemap").isRegularFile()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/B.framework/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders/dummy_p.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/resource.txt").isRegularFile()); - } - - if (productName == "C") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/C").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers/dummy.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Info.plist").isRegularFile()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules").isRegularDir()); - //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules/module.modulemap").isRegularFile()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/C.framework/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders/dummy_p.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/resource.txt").isRegularFile()); - } - - if (productName == "D") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/D").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Headers").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Headers/dummy.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Info.plist").isRegularFile()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/D.bundle/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/PrivateHeaders").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/PrivateHeaders/dummy_p.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/resource.txt").isRegularFile()); - } - - if (productName == "E") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/E").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Headers").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Headers/dummy.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Info.plist").isRegularFile()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/E.appex/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/PrivateHeaders").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/PrivateHeaders/dummy_p.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/resource.txt").isRegularFile()); - } - - if (productName == "F") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/F").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Headers").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Headers/dummy.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Info.plist").isRegularFile()); - QVERIFY(!QFileInfo2(defaultInstallRoot + "/F.xpc/PkgInfo").exists()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/PrivateHeaders").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/PrivateHeaders/dummy_p.h").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/resource.txt").isRegularFile()); - } - - if (productName == "G") { - QVERIFY(QFileInfo2(defaultInstallRoot + "/G").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/G/ContentInfo.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/G/Contents/resource.txt").isRegularFile()); - } - } -} - -void TestBlackbox::bundleStructure_data() -{ - QTest::addColumn<QString>("productName"); - QTest::addColumn<QString>("productTypeIdentifier"); - QTest::addColumn<bool>("isShallow"); - - const auto addRows = [](bool isShallow) { - const QString s = (isShallow ? " shallow" : ""); - QTest::newRow(("A" + s).toLatin1()) << "A" << "com.apple.product-type.application" << isShallow; - QTest::newRow(("ABadApple" + s).toLatin1()) << "ABadApple" << "com.apple.product-type.will.never.exist.ever.guaranteed" << isShallow; - QTest::newRow(("ABadThirdParty" + s).toLatin1()) << "ABadThirdParty" << "org.special.third.party.non.existent.product.type" << isShallow; - QTest::newRow(("B" + s).toLatin1()) << "B" << "com.apple.product-type.framework" << isShallow; - QTest::newRow(("C" + s).toLatin1()) << "C" << "com.apple.product-type.framework.static" << isShallow; - QTest::newRow(("D" + s).toLatin1()) << "D" << "com.apple.product-type.bundle" << isShallow; - QTest::newRow(("E" + s).toLatin1()) << "E" << "com.apple.product-type.app-extension" << isShallow; - QTest::newRow(("F" + s).toLatin1()) << "F" << "com.apple.product-type.xpc-service" << isShallow; - QTest::newRow(("G" + s).toLatin1()) << "G" << "com.apple.product-type.in-app-purchase-content" << isShallow; - }; - - addRows(true); - addRows(false); -} - void TestBlackbox::changedFiles_data() { QTest::addColumn<bool>("useChangedFilesForInitialBuild"); @@ -902,134 +587,6 @@ void TestBlackbox::dependencyProfileMismatch() m_qbsStderr.constData()); } -void TestBlackbox::deploymentTarget() -{ - if (!HostOsInfo::isMacosHost()) - QSKIP("only applies on macOS"); - - QFETCH(QString, sdk); - QFETCH(QString, os); - QFETCH(QString, arch); - QFETCH(QString, cflags); - QFETCH(QString, lflags); - - QDir::setCurrent(testDataDir + "/deploymentTarget"); - - QbsRunParameters params; - params.arguments = QStringList() - << "--command-echo-mode" - << "command-line" - << "qbs.targetOS:" + os - << "qbs.architectures:" + arch; - - rmDirR(relativeBuildDir()); - int status = runQbs(params); - - const QStringList skippableMessages = QStringList() - << "There is no matching SDK available for " + sdk + "." - << "x86_64h will be mis-detected as x86_64 with Apple Clang < 6.0" - << "clang: error: unknown argument: '-mtvos-version-min" - << "clang: error: unknown argument: '-mtvos-simulator-version-min" - << "clang: error: unknown argument: '-mwatchos-version-min" - << "clang: error: unknown argument: '-mwatchos-simulator-version-min"; - if (status != 0) { - for (const auto &message : skippableMessages) { - if (m_qbsStderr.contains(message.toUtf8())) - QSKIP(message.toUtf8()); - } - } - - QCOMPARE(status, 0); - QVERIFY2(m_qbsStderr.contains(cflags.toLatin1()), m_qbsStderr.constData()); - QVERIFY2(m_qbsStderr.contains(lflags.toLatin1()), m_qbsStderr.constData()); -} - -static qbs::Internal::Version findXcodeVersion() -{ - QProcess process; - process.start("pkgutil", QStringList("--pkg-info-plist=com.apple.pkg.Xcode")); - process.waitForFinished(); - - QDomDocument xcodeVersionDoc; - if (xcodeVersionDoc.setContent(process.readAllStandardOutput())) { - QDomNodeList nodes = xcodeVersionDoc.elementsByTagName(QStringLiteral("key")); - for (int i = 0; i < nodes.count(); ++i) { - QDomElement elem = nodes.at(i).toElement(); - if (elem.text().compare(QStringLiteral("pkg-version")) == 0) { - return qbs::Internal::Version::fromString( - QStringList(elem.nextSiblingElement().text().split( - QLatin1Char('.')).mid(0, 3)).join(QLatin1Char('.')), true); - } - } - } - - return qbs::Internal::Version(); -} - -void TestBlackbox::deploymentTarget_data() -{ - static const QString macos = QStringLiteral("macos,darwin,bsd,unix"); - static const QString ios = QStringLiteral("ios,darwin,bsd,unix"); - static const QString ios_sim = QStringLiteral("ios-simulator,") + ios; - static const QString tvos = QStringLiteral("tvos,darwin,bsd,unix"); - static const QString tvos_sim = QStringLiteral("tvos-simulator,") + tvos; - static const QString watchos = QStringLiteral("watchos,darwin,bsd,unix"); - static const QString watchos_sim = QStringLiteral("watchos-simulator,") + watchos; - - QTest::addColumn<QString>("sdk"); - QTest::addColumn<QString>("os"); - QTest::addColumn<QString>("arch"); - QTest::addColumn<QString>("cflags"); - QTest::addColumn<QString>("lflags"); - - QTest::newRow("macos x86") << "macosx" << macos << "x86" - << "-triple i386-apple-macosx10.4" - << "-macosx_version_min 10.4"; - QTest::newRow("macos x86_64") << "macosx" << macos << "x86_64" - << "-triple x86_64-apple-macosx10.4" - << "-macosx_version_min 10.4"; - - const auto xcodeVersion = findXcodeVersion(); - if (xcodeVersion >= qbs::Internal::Version(6)) - QTest::newRow("macos x86_64h") << "macosx" << macos << "x86_64h" - << "-triple x86_64h-apple-macosx10.12" - << "-macosx_version_min 10.12"; - - QTest::newRow("ios armv7a") << "iphoneos" << ios << "armv7a" - << "-triple thumbv7-apple-ios6.0" - << "-iphoneos_version_min 6.0"; - QTest::newRow("ios armv7s") << "iphoneos" <<ios << "armv7s" - << "-triple thumbv7s-apple-ios7.0" - << "-iphoneos_version_min 7.0"; - QTest::newRow("ios arm64") << "iphoneos" <<ios << "arm64" - << "-triple arm64-apple-ios7.0" - << "-iphoneos_version_min 7.0"; - QTest::newRow("ios-simulator x86") << "iphonesimulator" << ios_sim << "x86" - << "-triple i386-apple-ios6.0" - << "-ios_simulator_version_min 6.0"; - QTest::newRow("ios-simulator x86_64") << "iphonesimulator" << ios_sim << "x86_64" - << "-triple x86_64-apple-ios7.0" - << "-ios_simulator_version_min 7.0"; - - if (xcodeVersion >= qbs::Internal::Version(7)) { - if (xcodeVersion >= qbs::Internal::Version(7, 1)) { - QTest::newRow("tvos arm64") << "appletvos" << tvos << "arm64" - << "-triple arm64-apple-tvos9.0" - << "-tvos_version_min 9.0"; - QTest::newRow("tvos-simulator x86_64") << "appletvsimulator" << tvos_sim << "x86_64" - << "-triple x86_64-apple-tvos9.0" - << "-tvos_simulator_version_min 9.0"; - } - - QTest::newRow("watchos armv7k") << "watchos" << watchos << "armv7k" - << "-triple thumbv7k-apple-watchos2.0" - << "-watchos_version_min 2.0"; - QTest::newRow("watchos-simulator x86") << "watchsimulator" << watchos_sim << "x86" - << "-triple i386-apple-watchos2.0" - << "-watchos_simulator_version_min 2.0"; - } -} - void TestBlackbox::deprecatedProperty() { QDir::setCurrent(testDataDir + "/deprecated-property"); @@ -4235,38 +3792,6 @@ void TestBlackbox::nsis() QVERIFY(!QFile::exists(defaultInstallRoot + "/you-should-not-see-a-file-with-this-name.exe")); } -QString getEmbeddedBinaryPlist(const QString &file) -{ - QProcess p; - p.start("otool", QStringList() << "-v" << "-X" << "-s" << "__TEXT" << "__info_plist" << file); - p.waitForFinished(); - return QString::fromUtf8(p.readAllStandardOutput()).trimmed(); -} - -void TestBlackbox::embedInfoPlist() -{ - if (!HostOsInfo::isMacosHost()) - QSKIP("only applies on macOS"); - - QDir::setCurrent(testDataDir + QLatin1String("/embedInfoPlist")); - - QbsRunParameters params; - QCOMPARE(runQbs(params), 0); - - QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/app").isEmpty()); - QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/liblib.dylib").isEmpty()); - QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/mod.bundle").isEmpty()); - - params.arguments = QStringList(QLatin1String("modules.bundle.embedInfoPlist:false")); - params.expectFailure = true; - rmDirR(relativeBuildDir()); - QCOMPARE(runQbs(params), 0); - - QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/app").isEmpty()); - QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/liblib.dylib").isEmpty()); - QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/mod.bundle").isEmpty()); -} - void TestBlackbox::enableExceptions() { QFETCH(QString, file); @@ -4337,36 +3862,6 @@ void TestBlackbox::enableRtti() } } -void TestBlackbox::frameworkStructure() -{ - if (!HostOsInfo::isMacosHost()) - QSKIP("only applies on macOS"); - - QDir::setCurrent(testDataDir + QLatin1String("/frameworkStructure")); - - QbsRunParameters params; - QCOMPARE(runQbs(params), 0); - - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Widget")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Headers/Widget.h")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/PrivateHeaders/WidgetPrivate.h")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/BaseResource")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/en.lproj/EnglishResource")); - QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/Current")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); - QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); - QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); - QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Resources")); - - params.command = "resolve"; - params.arguments = QStringList() << "project.includeHeaders:false"; - QCOMPARE(runQbs(params), 0); - QCOMPARE(runQbs(), 0); - - QVERIFY(!directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); - QVERIFY(!directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); -} - void TestBlackbox::generatedArtifactAsInputToDynamicRule() { QDir::setCurrent(testDataDir + "/generated-artifact-as-input-to-dynamic-rule"); @@ -4523,34 +4018,6 @@ void TestBlackbox::typescript() QVERIFY(regularFileExists(relativeProductBuildDir("animals") + "/main.js")); } -void TestBlackbox::iconset() -{ - if (!HostOsInfo::isMacosHost() || !isXcodeProfile(profileName())) - QSKIP("only applies on macOS with Xcode based profiles"); - - QDir::setCurrent(testDataDir + QLatin1String("/ib/iconset")); - - QbsRunParameters params; - params.arguments = QStringList() << "-f" << "iconset.qbs"; - QCOMPARE(runQbs(params), 0); - - QVERIFY(regularFileExists(relativeProductBuildDir("iconset") + "/white.icns")); -} - -void TestBlackbox::iconsetApp() -{ - if (!HostOsInfo::isMacosHost() || !isXcodeProfile(profileName())) - QSKIP("only applies on macOS with Xcode based profiles"); - - QDir::setCurrent(testDataDir + QLatin1String("/ib/iconsetapp")); - - QbsRunParameters params; - params.arguments = QStringList() << "-f" << "iconsetapp.qbs"; - QCOMPARE(runQbs(params), 0); - - QVERIFY(regularFileExists(relativeProductBuildDir("iconsetapp") + "/iconsetapp.app/Contents/Resources/white.icns")); -} - void TestBlackbox::importInPropertiesCondition() { QDir::setCurrent(testDataDir + "/import-in-properties-condition"); @@ -4569,25 +4036,6 @@ void TestBlackbox::importsConflict() QCOMPARE(runQbs(), 0); } -void TestBlackbox::infoPlist() -{ - if (!HostOsInfo::isMacosHost()) - QSKIP("only applies on macOS"); - - QDir::setCurrent(testDataDir + "/infoplist"); - - QbsRunParameters params; - params.arguments = QStringList() << "-f" << "infoplist.qbs"; - QCOMPARE(runQbs(params), 0); - - QFile infoplist(relativeProductBuildDir("infoplist") + "/infoplist.app/Contents/Info.plist"); - QVERIFY(infoplist.open(QIODevice::ReadOnly)); - const QByteArray fileContents = infoplist.readAll(); - QVERIFY2(fileContents.contains("<key>LSMinimumSystemVersion</key>"), fileContents.constData()); - QVERIFY2(fileContents.contains("<string>10.7</string>"), fileContents.constData()); - QVERIFY2(fileContents.contains("<key>NSPrincipalClass</key>"), fileContents.constData()); -} - static bool haveInnoSetup(const Profile &profile) { if (profile.value("innosetup.toolchainInstallPath").isValid()) @@ -4637,126 +4085,6 @@ void TestBlackbox::innoSetup() QVERIFY(regularFileExists(relativeProductBuildDir("Example1") + "/Example1.exe")); } -void TestBlackbox::assetCatalog() -{ - QFETCH(bool, flatten); - - if (!HostOsInfo::isMacosHost() || !isXcodeProfile(profileName())) - QSKIP("only applies on macOS with Xcode based profiles"); - - if (HostOsInfo::hostOsVersion() < qbs::Internal::Version(10, 9)) - QSKIP("This test needs at least macOS 10.9."); - - QDir::setCurrent(testDataDir + QLatin1String("/ib/assetcatalog")); - - rmDirR(relativeBuildDir()); - - QbsRunParameters params; - const QString flattens = "ib.flatten:" + QString(flatten ? "true" : "false"); - - // Make sure a dry run does not write anything - params.arguments = QStringList() << "-f" << "assetcatalogempty.qbs" << "--dry-run" << flattens; - QCOMPARE(runQbs(params), 0); - QVERIFY(!directoryExists(relativeBuildDir())); - - params.arguments = QStringList() << "-f" << "assetcatalogempty.qbs" << flattens; - QCOMPARE(runQbs(params), 0); - - // empty asset catalogs must still produce output - QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets")); - - // should not produce a CAR since minimumMacosVersion will be < 10.9 - QVERIFY(!regularFileExists(relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Assets.car")); - - rmDirR(relativeBuildDir()); - params.arguments.append("cpp.minimumMacosVersion:10.9"); // force CAR generation - QCOMPARE(runQbs(params), 0); - - // empty asset catalogs must still produce output - QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets")); - QVERIFY(regularFileExists(relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Assets.car")); - - // this asset catalog happens to have an embedded icon set, - // but this should NOT be built since it is not in the files list - QVERIFY(!(bool)m_qbsStdout.contains(".iconset")); - - // now we'll add the iconset - rmDirR(relativeBuildDir()); - params.arguments.append("project.includeIconset:true"); - QCOMPARE(runQbs(params), 0); - QVERIFY(!(bool)m_qbsStdout.contains("compiling empty.xcassets")); - QVERIFY((bool)m_qbsStdout.contains("compiling empty.iconset")); - - // make sure the nibs/storyboards are in there - QString nib = relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/MainMenu.nib"; - QStringList nibFiles; - if (flatten) { - QVERIFY(regularFileExists(nib)); - } else { - QVERIFY(directoryExists(nib)); - nibFiles = QStringList() << "designable.nib" << "keyedobjects.nib"; - } - - QString storyboardc = relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Storyboard.storyboardc"; - QStringList storyboardcFiles; - if (HostOsInfo::hostOsVersion() >= qbs::Internal::Version(10, 10)) { - QVERIFY(directoryExists(storyboardc)); - - storyboardcFiles = QStringList() - << "1os-k8-h10-view-qKA-a5-eUe.nib" - << "Info.plist" - << "Iqk-Fi-Vhk-view-HRv-3O-Qxh.nib" - << "Main.nib" - << "NSViewController-Iqk-Fi-Vhk.nib" - << "NSViewController-Yem-rc-72E.nib" - << "Yem-rc-72E-view-ODp-aO-Dmf.nib"; - - if (!flatten) { - storyboardcFiles << "designable.storyboard"; - storyboardcFiles.sort(); - } - } - - QCOMPARE(QDir(nib).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), nibFiles); - QCOMPARE(QDir(storyboardc).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), storyboardcFiles); - QbsRunParameters params2 = params; - params2.command = "clean"; - QCOMPARE(runQbs(params2), 0); - QCOMPARE(QDir(nib).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), QStringList()); - QCOMPARE(QDir(storyboardc).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), QStringList()); - - QDir::setCurrent(testDataDir + QLatin1String("/ib/multiple-asset-catalogs")); - rmDirR(relativeBuildDir()); - params.arguments = QStringList(); - QCOMPARE(runQbs(params), 0); - QVERIFY2(m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout); - QVERIFY2(m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout); - - QDir::setCurrent(testDataDir + QLatin1String("/ib/empty-asset-catalogs")); - rmDirR(relativeBuildDir()); - params.arguments = QStringList(); - QCOMPARE(runQbs(params), 0); - QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout); - QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout); -} - -void TestBlackbox::assetCatalog_data() -{ - QTest::addColumn<bool>("flatten"); - QTest::newRow("flattened") << true; - QTest::newRow("unflattened") << false; -} - -void TestBlackbox::objcArc() -{ - if (!HostOsInfo::isMacosHost()) - QSKIP("only applies on platforms supporting Objective-C"); - - QDir::setCurrent(testDataDir + QLatin1String("/objc-arc")); - - QCOMPARE(runQbs(), 0); -} - void TestBlackbox::outputArtifactAutoTagging() { QDir::setCurrent(testDataDir + QLatin1String("/output-artifact-auto-tagging")); @@ -4950,44 +4278,4 @@ void TestBlackbox::probesInNestedModules() QVERIFY(m_qbsStdout.contains("product a, outer.something = hahaha")); } -void TestBlackbox::xcode() -{ - if (!HostOsInfo::isMacosHost() || !isXcodeProfile(profileName())) - QSKIP("only applies on macOS with Xcode based profiles"); - - QProcess xcodeSelect; - xcodeSelect.start("xcode-select", QStringList() << "--print-path"); - QVERIFY2(xcodeSelect.waitForStarted(), qPrintable(xcodeSelect.errorString())); - QVERIFY2(xcodeSelect.waitForFinished(), qPrintable(xcodeSelect.errorString())); - QVERIFY2(xcodeSelect.exitCode() == 0, qPrintable(xcodeSelect.readAllStandardError().constData())); - const QString developerPath(QString::fromLocal8Bit(xcodeSelect.readAllStandardOutput().trimmed())); - - std::multimap<std::string, std::string> sdks; - - QProcess xcodebuildShowSdks; - xcodebuildShowSdks.start("xcrun", QStringList() << "xcodebuild" << "-showsdks"); - QVERIFY2(xcodebuildShowSdks.waitForStarted(), qPrintable(xcodebuildShowSdks.errorString())); - QVERIFY2(xcodebuildShowSdks.waitForFinished(), qPrintable(xcodebuildShowSdks.errorString())); - QVERIFY2(xcodebuildShowSdks.exitCode() == 0, qPrintable(xcodebuildShowSdks.readAllStandardError().constData())); - for (const QString &line : QString::fromLocal8Bit(xcodebuildShowSdks.readAllStandardOutput().trimmed()).split('\n', QString::SkipEmptyParts)) { - static const std::regex regexp("^.+\\s+\\-sdk\\s+([a-z]+)([0-9]+\\.[0-9]+)$"); - const auto ln = line.toStdString(); - std::smatch match; - if (std::regex_match(ln, match, regexp)) - sdks.insert({ match[1], match[2] }); - } - - auto range = sdks.equal_range("macosx"); - QStringList sdkValues; - for (auto i = range.first; i != range.second; ++i) - sdkValues.push_back(QString::fromStdString(i->second)); - - QDir::setCurrent(testDataDir + "/xcode"); - QbsRunParameters params; - params.arguments = (QStringList() - << (QStringLiteral("xcode.developerPath:") + developerPath) - << (QStringLiteral("project.sdks:['") + sdkValues.join("','") + "']")); - QCOMPARE(runQbs(params), 0); -} - QTEST_MAIN(TestBlackbox) diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index bff0244ec..087c941b3 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -41,15 +41,10 @@ public: private slots: void alwaysRun(); void alwaysRun_data(); - void appleMultiConfig(); void artifactScanning(); void assembly(); - void assetCatalog(); - void assetCatalog_data(); void badInterpreter(); void buildDirectories(); - void bundleStructure(); - void bundleStructure_data(); void changedFiles_data(); void changedFiles(); void changeInDisabledProduct(); @@ -65,12 +60,9 @@ private slots: void conflictingArtifacts(); void dependenciesProperty(); void dependencyProfileMismatch(); - void deploymentTarget(); - void deploymentTarget_data(); void deprecatedProperty(); void dynamicMultiplexRule(); void dynamicRuleOutputs(); - void embedInfoPlist(); void enableExceptions(); void enableExceptions_data(); void enableRtti(); @@ -82,15 +74,11 @@ private slots: void exportToOutsideSearchPath(); void externalLibs(); void fileDependencies(); - void frameworkStructure(); void generatedArtifactAsInputToDynamicRule(); void groupsInModules(); - void iconset(); - void iconsetApp(); void importInPropertiesCondition(); void importingProduct(); void importsConflict(); - void infoPlist(); void innoSetup(); void inputsFromDependencies(); void installable(); @@ -129,7 +117,6 @@ private slots: void nonBrokenFilesInBrokenProduct(); void nonDefaultProduct(); void nsis(); - void objcArc(); void outputArtifactAutoTagging(); void overrideProjectProperties(); void pchChangeTracking(); @@ -201,7 +188,6 @@ private slots: void wildCardsAndRules(); void wildcardRenaming(); void wix(); - void xcode(); void zip(); void zip_data(); void zipInvalid(); diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp new file mode 100644 index 000000000..1ba0a5266 --- /dev/null +++ b/tests/auto/blackbox/tst_blackboxapple.cpp @@ -0,0 +1,729 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "tst_blackboxapple.h" + +#include "../shared.h" +#include <tools/hostosinfo.h> +#include <tools/profile.h> + +#include <QtXml/qdom.h> + +#include <regex> + +#define WAIT_FOR_NEW_TIMESTAMP() waitForNewTimestamp(testDataDir) + +using qbs::Internal::HostOsInfo; +using qbs::Profile; + +class QFileInfo2 : public QFileInfo { +public: + QFileInfo2(const QString &path) : QFileInfo(path) { } + bool isRegularFile() const { return isFile() && !isSymLink(); } + bool isRegularDir() const { return isDir() && !isSymLink(); } + bool isFileSymLink() const { return isFile() && isSymLink(); } + bool isDirSymLink() const { return isDir() && isSymLink(); } +}; + +static qbs::Internal::Version findXcodeVersion() +{ + QProcess process; + process.start("pkgutil", QStringList("--pkg-info-plist=com.apple.pkg.Xcode")); + process.waitForFinished(); + + QDomDocument xcodeVersionDoc; + if (xcodeVersionDoc.setContent(process.readAllStandardOutput())) { + QDomNodeList nodes = xcodeVersionDoc.elementsByTagName(QStringLiteral("key")); + for (int i = 0; i < nodes.count(); ++i) { + QDomElement elem = nodes.at(i).toElement(); + if (elem.text().compare(QStringLiteral("pkg-version")) == 0) { + return qbs::Internal::Version::fromString( + QStringList(elem.nextSiblingElement().text().split( + QLatin1Char('.')).mid(0, 3)).join(QLatin1Char('.')), true); + } + } + } + + return qbs::Internal::Version(); +} + +static QString getEmbeddedBinaryPlist(const QString &file) +{ + QProcess p; + p.start("otool", QStringList() << "-v" << "-X" << "-s" << "__TEXT" << "__info_plist" << file); + p.waitForFinished(); + return QString::fromUtf8(p.readAllStandardOutput()).trimmed(); +} + +TestBlackboxApple::TestBlackboxApple() + : TestBlackboxBase (SRCDIR "/testdata-apple", "blackbox-apple") +{ +} + +void TestBlackboxApple::initTestCase() +{ + if (!HostOsInfo::isMacosHost()) { + QSKIP("only applies on macOS"); + return; + } + + TestBlackboxBase::initTestCase(); +} + +void TestBlackboxApple::appleMultiConfig() +{ + QDir::setCurrent(testDataDir + "/apple-multiconfig"); + QCOMPARE(runQbs(), 0); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/MacOS/singleapp").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/MacOS/singleapp_agg").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/singlelib").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Resources").isDirSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/singlelib").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/Current").isDirSymLink()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/MacOS/fatmultiapp").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/MacOS/fatmultiapp_debug").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Resources").isDirSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_debug").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_profile").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/Current").isDirSymLink()); + + for (const QString &variant : { "release", "debug", "profile" }) { + for (const QString &arch : { "x86_64" }) { + QProcess process; + process.setProgram("/usr/bin/arch"); + process.setArguments({ + "-arch", arch, + "-e", "DYLD_IMAGE_SUFFIX=_" + variant, + defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp" + }); + process.start(); + process.waitForFinished(); + QCOMPARE(process.exitCode(), 0); + const auto processStdout = process.readAllStandardOutput(); + QVERIFY2(processStdout.contains("Hello from " + variant.toUtf8() + " " + arch.toUtf8()), + processStdout.constData()); + } + } +} + +void TestBlackboxApple::assetCatalog() +{ + QFETCH(bool, flatten); + + if (HostOsInfo::hostOsVersion() < qbs::Internal::Version(10, 9)) + QSKIP("This test needs at least macOS 10.9."); + + QDir::setCurrent(testDataDir + QLatin1String("/ib/assetcatalog")); + + rmDirR(relativeBuildDir()); + + QbsRunParameters params; + const QString flattens = "ib.flatten:" + QString(flatten ? "true" : "false"); + + // Make sure a dry run does not write anything + params.arguments = QStringList() << "-f" << "assetcatalogempty.qbs" << "--dry-run" << flattens; + QCOMPARE(runQbs(params), 0); + QVERIFY(!directoryExists(relativeBuildDir())); + + params.arguments = QStringList() << "-f" << "assetcatalogempty.qbs" << flattens; + QCOMPARE(runQbs(params), 0); + + // empty asset catalogs must still produce output + QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets")); + + // should not produce a CAR since minimumMacosVersion will be < 10.9 + QVERIFY(!regularFileExists(relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Assets.car")); + + rmDirR(relativeBuildDir()); + params.arguments.append("cpp.minimumMacosVersion:10.9"); // force CAR generation + QCOMPARE(runQbs(params), 0); + + // empty asset catalogs must still produce output + QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets")); + QVERIFY(regularFileExists(relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Assets.car")); + + // this asset catalog happens to have an embedded icon set, + // but this should NOT be built since it is not in the files list + QVERIFY(!(bool)m_qbsStdout.contains(".iconset")); + + // now we'll add the iconset + rmDirR(relativeBuildDir()); + params.arguments.append("project.includeIconset:true"); + QCOMPARE(runQbs(params), 0); + QVERIFY(!(bool)m_qbsStdout.contains("compiling empty.xcassets")); + QVERIFY((bool)m_qbsStdout.contains("compiling empty.iconset")); + + // make sure the nibs/storyboards are in there + QString nib = relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/MainMenu.nib"; + QStringList nibFiles; + if (flatten) { + QVERIFY(regularFileExists(nib)); + } else { + QVERIFY(directoryExists(nib)); + nibFiles = QStringList() << "designable.nib" << "keyedobjects.nib"; + } + + QString storyboardc = relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Storyboard.storyboardc"; + QStringList storyboardcFiles; + if (HostOsInfo::hostOsVersion() >= qbs::Internal::Version(10, 10)) { + QVERIFY(directoryExists(storyboardc)); + + storyboardcFiles = QStringList() + << "1os-k8-h10-view-qKA-a5-eUe.nib" + << "Info.plist" + << "Iqk-Fi-Vhk-view-HRv-3O-Qxh.nib" + << "Main.nib" + << "NSViewController-Iqk-Fi-Vhk.nib" + << "NSViewController-Yem-rc-72E.nib" + << "Yem-rc-72E-view-ODp-aO-Dmf.nib"; + + if (!flatten) { + storyboardcFiles << "designable.storyboard"; + storyboardcFiles.sort(); + } + } + + QCOMPARE(QDir(nib).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), nibFiles); + QCOMPARE(QDir(storyboardc).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), storyboardcFiles); + QbsRunParameters params2 = params; + params2.command = "clean"; + QCOMPARE(runQbs(params2), 0); + QCOMPARE(QDir(nib).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), QStringList()); + QCOMPARE(QDir(storyboardc).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), QStringList()); + + QDir::setCurrent(testDataDir + QLatin1String("/ib/multiple-asset-catalogs")); + rmDirR(relativeBuildDir()); + params.arguments = QStringList(); + QCOMPARE(runQbs(params), 0); + QVERIFY2(m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout); + QVERIFY2(m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout); + + QDir::setCurrent(testDataDir + QLatin1String("/ib/empty-asset-catalogs")); + rmDirR(relativeBuildDir()); + params.arguments = QStringList(); + QCOMPARE(runQbs(params), 0); + QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout); + QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout); +} + +void TestBlackboxApple::assetCatalog_data() +{ + QTest::addColumn<bool>("flatten"); + QTest::newRow("flattened") << true; + QTest::newRow("unflattened") << false; +} + +void TestBlackboxApple::bundleStructure() +{ + QFETCH(QString, productName); + QFETCH(QString, productTypeIdentifier); + QFETCH(bool, isShallow); + + QDir::setCurrent(testDataDir + "/bundle-structure"); + QbsRunParameters params; + params.arguments << "project.buildableProducts:" + productName; + if (isShallow) { + // Coerce shallow bundles - don't set bundle.isShallow directly because we want to test the + // automatic detection + params.arguments + << "qbs.targetOS:ios,darwin,bsd,unix" + << "qbs.architectures:arm64"; + } + + if (productName == "ABadApple" || productName == "ABadThirdParty") + params.expectFailure = true; + + rmDirR(relativeBuildDir()); + const int status = runQbs(params); + if (status != 0) { + QVERIFY2(m_qbsStderr.contains("Bundle product type " + + productTypeIdentifier.toLatin1() + + " is not supported."), + m_qbsStderr.constData()); + return; + } + + QCOMPARE(status, 0); + + if (!isShallow) { + if (productName == "A") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/MacOS").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/MacOS/A").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/PkgInfo").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Resources/resource.txt").isRegularFile()); + } + + if (productName == "B") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/B").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers").isDirSymLink()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules").isDirSymLink()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/B.framework/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders").isDirSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Resources").isDirSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/B").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Headers").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Headers/dummy.h").isRegularFile()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Modules").isRegularDir()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Modules/module.modulemap").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/PrivateHeaders").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/PrivateHeaders/dummy_p.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Resources/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/Current").isDirSymLink()); + } + + if (productName == "C") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/C").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers").isDirSymLink()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules").isDirSymLink()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/C.framework/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders").isDirSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Resources").isDirSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/C").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Headers").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Headers/dummy.h").isRegularFile()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Modules").isRegularDir()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Modules/module.modulemap").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/PrivateHeaders").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/PrivateHeaders/dummy_p.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Resources/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/Current").isDirSymLink()); + } + + if (productName == "D") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/MacOS").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/MacOS/D").isRegularFile()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Resources/resource.txt").isRegularFile()); + } + + if (productName == "E") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/MacOS").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/MacOS/E").isRegularFile()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/E.appex/Contents/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Resources/resource.txt").isRegularFile()); + } + + if (productName == "F") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/MacOS").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/MacOS/F").isRegularFile()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Resources/resource.txt").isRegularFile()); + } + + if (productName == "G") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/G").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/G/ContentInfo.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/G/Contents/resource.txt").isRegularFile()); + } + } else { + if (productName == "A") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/A").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/PkgInfo").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/resource.txt").isRegularFile()); + } + + if (productName == "B") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/B").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers/dummy.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Info.plist").isRegularFile()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules").isRegularDir()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules/module.modulemap").isRegularFile()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/B.framework/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders/dummy_p.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/resource.txt").isRegularFile()); + } + + if (productName == "C") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/C").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers/dummy.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Info.plist").isRegularFile()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules").isRegularDir()); + //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules/module.modulemap").isRegularFile()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/C.framework/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders/dummy_p.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/resource.txt").isRegularFile()); + } + + if (productName == "D") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/D").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Headers").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Headers/dummy.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Info.plist").isRegularFile()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/D.bundle/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/PrivateHeaders").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/PrivateHeaders/dummy_p.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/resource.txt").isRegularFile()); + } + + if (productName == "E") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/E").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Headers").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Headers/dummy.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Info.plist").isRegularFile()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/E.appex/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/PrivateHeaders").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/PrivateHeaders/dummy_p.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/resource.txt").isRegularFile()); + } + + if (productName == "F") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/F").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Headers").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Headers/dummy.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Info.plist").isRegularFile()); + QVERIFY(!QFileInfo2(defaultInstallRoot + "/F.xpc/PkgInfo").exists()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/PrivateHeaders").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/PrivateHeaders/dummy_p.h").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/resource.txt").isRegularFile()); + } + + if (productName == "G") { + QVERIFY(QFileInfo2(defaultInstallRoot + "/G").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/G/ContentInfo.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/G/Contents/resource.txt").isRegularFile()); + } + } +} + +void TestBlackboxApple::bundleStructure_data() +{ + QTest::addColumn<QString>("productName"); + QTest::addColumn<QString>("productTypeIdentifier"); + QTest::addColumn<bool>("isShallow"); + + const auto addRows = [](bool isShallow) { + const QString s = (isShallow ? " shallow" : ""); + QTest::newRow(("A" + s).toLatin1()) << "A" << "com.apple.product-type.application" << isShallow; + QTest::newRow(("ABadApple" + s).toLatin1()) << "ABadApple" << "com.apple.product-type.will.never.exist.ever.guaranteed" << isShallow; + QTest::newRow(("ABadThirdParty" + s).toLatin1()) << "ABadThirdParty" << "org.special.third.party.non.existent.product.type" << isShallow; + QTest::newRow(("B" + s).toLatin1()) << "B" << "com.apple.product-type.framework" << isShallow; + QTest::newRow(("C" + s).toLatin1()) << "C" << "com.apple.product-type.framework.static" << isShallow; + QTest::newRow(("D" + s).toLatin1()) << "D" << "com.apple.product-type.bundle" << isShallow; + QTest::newRow(("E" + s).toLatin1()) << "E" << "com.apple.product-type.app-extension" << isShallow; + QTest::newRow(("F" + s).toLatin1()) << "F" << "com.apple.product-type.xpc-service" << isShallow; + QTest::newRow(("G" + s).toLatin1()) << "G" << "com.apple.product-type.in-app-purchase-content" << isShallow; + }; + + addRows(true); + addRows(false); +} + +void TestBlackboxApple::deploymentTarget() +{ + QFETCH(QString, sdk); + QFETCH(QString, os); + QFETCH(QString, arch); + QFETCH(QString, cflags); + QFETCH(QString, lflags); + + QDir::setCurrent(testDataDir + "/deploymentTarget"); + + QbsRunParameters params; + params.arguments = QStringList() + << "--command-echo-mode" + << "command-line" + << "qbs.targetOS:" + os + << "qbs.architectures:" + arch; + + rmDirR(relativeBuildDir()); + int status = runQbs(params); + + const QStringList skippableMessages = QStringList() + << "There is no matching SDK available for " + sdk + "." + << "x86_64h will be mis-detected as x86_64 with Apple Clang < 6.0" + << "clang: error: unknown argument: '-mtvos-version-min" + << "clang: error: unknown argument: '-mtvos-simulator-version-min" + << "clang: error: unknown argument: '-mwatchos-version-min" + << "clang: error: unknown argument: '-mwatchos-simulator-version-min"; + if (status != 0) { + for (const auto &message : skippableMessages) { + if (m_qbsStderr.contains(message.toUtf8())) + QSKIP(message.toUtf8()); + } + } + + QCOMPARE(status, 0); + QVERIFY2(m_qbsStderr.contains(cflags.toLatin1()), m_qbsStderr.constData()); + QVERIFY2(m_qbsStderr.contains(lflags.toLatin1()), m_qbsStderr.constData()); +} + +void TestBlackboxApple::deploymentTarget_data() +{ + static const QString macos = QStringLiteral("macos,darwin,bsd,unix"); + static const QString ios = QStringLiteral("ios,darwin,bsd,unix"); + static const QString ios_sim = QStringLiteral("ios-simulator,") + ios; + static const QString tvos = QStringLiteral("tvos,darwin,bsd,unix"); + static const QString tvos_sim = QStringLiteral("tvos-simulator,") + tvos; + static const QString watchos = QStringLiteral("watchos,darwin,bsd,unix"); + static const QString watchos_sim = QStringLiteral("watchos-simulator,") + watchos; + + QTest::addColumn<QString>("sdk"); + QTest::addColumn<QString>("os"); + QTest::addColumn<QString>("arch"); + QTest::addColumn<QString>("cflags"); + QTest::addColumn<QString>("lflags"); + + QTest::newRow("macos x86") << "macosx" << macos << "x86" + << "-triple i386-apple-macosx10.4" + << "-macosx_version_min 10.4"; + QTest::newRow("macos x86_64") << "macosx" << macos << "x86_64" + << "-triple x86_64-apple-macosx10.4" + << "-macosx_version_min 10.4"; + + const auto xcodeVersion = findXcodeVersion(); + if (xcodeVersion >= qbs::Internal::Version(6)) + QTest::newRow("macos x86_64h") << "macosx" << macos << "x86_64h" + << "-triple x86_64h-apple-macosx10.12" + << "-macosx_version_min 10.12"; + + QTest::newRow("ios armv7a") << "iphoneos" << ios << "armv7a" + << "-triple thumbv7-apple-ios6.0" + << "-iphoneos_version_min 6.0"; + QTest::newRow("ios armv7s") << "iphoneos" <<ios << "armv7s" + << "-triple thumbv7s-apple-ios7.0" + << "-iphoneos_version_min 7.0"; + QTest::newRow("ios arm64") << "iphoneos" <<ios << "arm64" + << "-triple arm64-apple-ios7.0" + << "-iphoneos_version_min 7.0"; + QTest::newRow("ios-simulator x86") << "iphonesimulator" << ios_sim << "x86" + << "-triple i386-apple-ios6.0" + << "-ios_simulator_version_min 6.0"; + QTest::newRow("ios-simulator x86_64") << "iphonesimulator" << ios_sim << "x86_64" + << "-triple x86_64-apple-ios7.0" + << "-ios_simulator_version_min 7.0"; + + if (xcodeVersion >= qbs::Internal::Version(7)) { + if (xcodeVersion >= qbs::Internal::Version(7, 1)) { + QTest::newRow("tvos arm64") << "appletvos" << tvos << "arm64" + << "-triple arm64-apple-tvos9.0" + << "-tvos_version_min 9.0"; + QTest::newRow("tvos-simulator x86_64") << "appletvsimulator" << tvos_sim << "x86_64" + << "-triple x86_64-apple-tvos9.0" + << "-tvos_simulator_version_min 9.0"; + } + + QTest::newRow("watchos armv7k") << "watchos" << watchos << "armv7k" + << "-triple thumbv7k-apple-watchos2.0" + << "-watchos_version_min 2.0"; + QTest::newRow("watchos-simulator x86") << "watchsimulator" << watchos_sim << "x86" + << "-triple i386-apple-watchos2.0" + << "-watchos_simulator_version_min 2.0"; + } +} + +void TestBlackboxApple::embedInfoPlist() +{ + QDir::setCurrent(testDataDir + QLatin1String("/embedInfoPlist")); + + QbsRunParameters params; + QCOMPARE(runQbs(params), 0); + + QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/app").isEmpty()); + QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/liblib.dylib").isEmpty()); + QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/mod.bundle").isEmpty()); + + params.arguments = QStringList(QLatin1String("modules.bundle.embedInfoPlist:false")); + params.expectFailure = true; + rmDirR(relativeBuildDir()); + QCOMPARE(runQbs(params), 0); + + QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/app").isEmpty()); + QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/liblib.dylib").isEmpty()); + QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/mod.bundle").isEmpty()); +} + +void TestBlackboxApple::frameworkStructure() +{ + QDir::setCurrent(testDataDir + QLatin1String("/frameworkStructure")); + + QbsRunParameters params; + QCOMPARE(runQbs(params), 0); + + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Widget")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Headers/Widget.h")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/PrivateHeaders/WidgetPrivate.h")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/BaseResource")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/en.lproj/EnglishResource")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/Current")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Resources")); + + params.command = "resolve"; + params.arguments = QStringList() << "project.includeHeaders:false"; + QCOMPARE(runQbs(params), 0); + QCOMPARE(runQbs(), 0); + + QVERIFY(!directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); + QVERIFY(!directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); +} + +void TestBlackboxApple::iconset() +{ + QDir::setCurrent(testDataDir + QLatin1String("/ib/iconset")); + + QbsRunParameters params; + params.arguments = QStringList() << "-f" << "iconset.qbs"; + QCOMPARE(runQbs(params), 0); + + QVERIFY(regularFileExists(relativeProductBuildDir("iconset") + "/white.icns")); +} + +void TestBlackboxApple::iconsetApp() +{ + QDir::setCurrent(testDataDir + QLatin1String("/ib/iconsetapp")); + + QbsRunParameters params; + params.arguments = QStringList() << "-f" << "iconsetapp.qbs"; + QCOMPARE(runQbs(params), 0); + + QVERIFY(regularFileExists(relativeProductBuildDir("iconsetapp") + "/iconsetapp.app/Contents/Resources/white.icns")); +} + +void TestBlackboxApple::infoPlist() +{ + QDir::setCurrent(testDataDir + "/infoplist"); + + QbsRunParameters params; + params.arguments = QStringList() << "-f" << "infoplist.qbs"; + QCOMPARE(runQbs(params), 0); + + QFile infoplist(relativeProductBuildDir("infoplist") + "/infoplist.app/Contents/Info.plist"); + QVERIFY(infoplist.open(QIODevice::ReadOnly)); + const QByteArray fileContents = infoplist.readAll(); + QVERIFY2(fileContents.contains("<key>LSMinimumSystemVersion</key>"), fileContents.constData()); + QVERIFY2(fileContents.contains("<string>10.7</string>"), fileContents.constData()); + QVERIFY2(fileContents.contains("<key>NSPrincipalClass</key>"), fileContents.constData()); +} + +void TestBlackboxApple::objcArc() +{ + QDir::setCurrent(testDataDir + QLatin1String("/objc-arc")); + + QCOMPARE(runQbs(), 0); +} + +void TestBlackboxApple::xcode() +{ + QProcess xcodeSelect; + xcodeSelect.start("xcode-select", QStringList() << "--print-path"); + QVERIFY2(xcodeSelect.waitForStarted(), qPrintable(xcodeSelect.errorString())); + QVERIFY2(xcodeSelect.waitForFinished(), qPrintable(xcodeSelect.errorString())); + QVERIFY2(xcodeSelect.exitCode() == 0, qPrintable(xcodeSelect.readAllStandardError().constData())); + const QString developerPath(QString::fromLocal8Bit(xcodeSelect.readAllStandardOutput().trimmed())); + + std::multimap<std::string, std::string> sdks; + + QProcess xcodebuildShowSdks; + xcodebuildShowSdks.start("xcrun", QStringList() << "xcodebuild" << "-showsdks"); + QVERIFY2(xcodebuildShowSdks.waitForStarted(), qPrintable(xcodebuildShowSdks.errorString())); + QVERIFY2(xcodebuildShowSdks.waitForFinished(), qPrintable(xcodebuildShowSdks.errorString())); + QVERIFY2(xcodebuildShowSdks.exitCode() == 0, qPrintable(xcodebuildShowSdks.readAllStandardError().constData())); + for (const QString &line : QString::fromLocal8Bit(xcodebuildShowSdks.readAllStandardOutput().trimmed()).split('\n', QString::SkipEmptyParts)) { + static const std::regex regexp("^.+\\s+\\-sdk\\s+([a-z]+)([0-9]+\\.[0-9]+)$"); + const auto ln = line.toStdString(); + std::smatch match; + if (std::regex_match(ln, match, regexp)) + sdks.insert({ match[1], match[2] }); + } + + auto range = sdks.equal_range("macosx"); + QStringList sdkValues; + for (auto i = range.first; i != range.second; ++i) + sdkValues.push_back(QString::fromStdString(i->second)); + + QDir::setCurrent(testDataDir + "/xcode"); + QbsRunParameters params; + params.arguments = (QStringList() + << (QStringLiteral("xcode.developerPath:") + developerPath) + << (QStringLiteral("project.sdks:['") + sdkValues.join("','") + "']")); + QCOMPARE(runQbs(params), 0); +} + +QTEST_MAIN(TestBlackboxApple) diff --git a/tests/auto/blackbox/tst_blackboxapple.h b/tests/auto/blackbox/tst_blackboxapple.h new file mode 100644 index 000000000..e53c4c6dd --- /dev/null +++ b/tests/auto/blackbox/tst_blackboxapple.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TST_BLACKBOXAPPLE_H +#define TST_BLACKBOXAPPLE_H + +#include "tst_blackboxbase.h" + +class TestBlackboxApple : public TestBlackboxBase +{ + Q_OBJECT + +public: + TestBlackboxApple(); + +public slots: + void initTestCase() override; + +private slots: + void appleMultiConfig(); + void assetCatalog(); + void assetCatalog_data(); + void bundleStructure(); + void bundleStructure_data(); + void deploymentTarget(); + void deploymentTarget_data(); + void embedInfoPlist(); + void frameworkStructure(); + void iconset(); + void iconsetApp(); + void infoPlist(); + void objcArc(); + void xcode(); +}; + +#endif // TST_BLACKBOXAPPLE_H diff --git a/tests/auto/blackbox/tst_blackboxbase.h b/tests/auto/blackbox/tst_blackboxbase.h index 7612636bd..6821b66a2 100644 --- a/tests/auto/blackbox/tst_blackboxbase.h +++ b/tests/auto/blackbox/tst_blackboxbase.h @@ -74,7 +74,7 @@ public: TestBlackboxBase(const QString &testDataSrcDir, const QString &testName); public slots: - void initTestCase(); + virtual void initTestCase(); protected: virtual void validateTestProfile() { } |