Skip to content

Commit 7ac4f9d

Browse files
committed
Update local test script and fix a few tests
1 parent 71c243f commit 7ac4f9d

File tree

4 files changed

+32
-16
lines changed

4 files changed

+32
-16
lines changed

crates/tests/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ all = [
2626
"objc2-foundation/NSDictionary",
2727
"objc2-foundation/NSValue",
2828
"objc2-foundation/NSObject",
29+
"objc2-foundation/NSEnumerator",
30+
"objc2-foundation/NSObjCRuntime",
2931
]
3032

3133
apple = ["block2/apple", "objc2/apple", "objc2-foundation/apple"]

framework-crates/objc2-foundation/src/tests/exception.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![cfg(feature = "NSException")]
22
#![cfg(feature = "NSString")]
33
#![cfg(feature = "NSDictionary")]
4+
#![cfg(feature = "NSObjCRuntime")]
45
use alloc::format;
56

67
use crate::Foundation::{NSException, NSObject, NSString};

framework-crates/objc2-foundation/src/tests/mutable_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn test_into_vec() {
110110
}
111111

112112
#[test]
113-
#[cfg(feature = "NSString")]
113+
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
114114
fn test_sort() {
115115
use Foundation::NSString;
116116

helper-scripts/test-local.sh

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
11
#!/bin/bash
22
# A test script I use to test on my local devices
33

4+
set -euxo pipefail
5+
6+
export CARGO_TARGET_DIR=$HOME/Desktop/objc2-target
47
export MACOSX_DEPLOYMENT_TARGET=10.12
5-
export IPHONEOS_DEPLOYMENT_TARGET=10.0
6-
export FEATURES=std,block,exception,catch-all,unstable-static-class,unstable-static-sel
8+
export CRATES='--package=block2 --package=objc-sys --package=objc2 --package=objc2-encode --package=objc2-proc-macros --package=tests'
9+
export FRAMEWORKS_MACOS_10_13='--package=objc2-app-kit --package=objc2-automator --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-core-data --package=objc2-core-wlan --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-external-accessory --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-input-method-kit --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-osa-kit --package=objc2-quartz-core --package=objc2-service-management --package=objc2-store-kit --package=objc2-web-kit'
10+
export FRAMEWORKS_IOS_9='--package=objc2-foundation --package=objc2-metal'
11+
12+
# Test on macOS 32bit
13+
export SDKROOT=$HOME/Desktop/MacOSX10.13.sdk
14+
cargo test $CRATES
15+
cargo test $CRATES --features=unstable-static-class,unstable-static-sel
16+
cargo test $CRATES $FRAMEWORKS_MACOS_10_13 --features=block2,exception,catch-all,all
17+
cargo test $CRATES --release
18+
cargo test -Zbuild-std --target=i686-apple-darwin $CRATES
19+
cargo test -Zbuild-std --target=i686-apple-darwin $CRATES $FRAMEWORKS_MACOS_10_13 --features=block2,exception,catch-all,all
20+
cargo test -Zbuild-std --target=i686-apple-darwin $CRATES --release
21+
unset SDKROOT
722

823
# Start the simulator
924
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
1025

1126
# Test on the simulator
12-
cargo dinghy --device sim test
13-
cargo dinghy --device sim test --features=$FEATURES
14-
cargo dinghy --device sim test --release
27+
IPHONEOS_DEPLOYMENT_TARGET=10.0 cargo dinghy --device sim test $CRATES
28+
IPHONEOS_DEPLOYMENT_TARGET=10.0 cargo dinghy --device sim test $CRATES --features=unstable-static-class,unstable-static-sel
29+
IPHONEOS_DEPLOYMENT_TARGET=10.0 cargo dinghy --device sim test $CRATES $FRAMEWORKS_IOS_9 --features=block2,exception,catch-all,all
30+
IPHONEOS_DEPLOYMENT_TARGET=10.0 cargo dinghy --device sim test $CRATES --release
1531

1632
# Test on my iPad mini 1st generation iOS 9.3
1733
# Followed this guide to set it up:
1834
# https://github.com/sonos/dinghy/blob/main/docs/ios.md
1935
#
2036
# We use build-std and earlier nightly because the target is armv7-apple-ios, which was removed in:
2137
# https://github.com/rust-lang/rust/pull/104385
22-
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std
23-
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std --features=$FEATURES
24-
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std --release
25-
26-
# Test on macOS 32bit
27-
export SDKROOT=(pwd)/ideas/MacOSX10.13.sdk
28-
export CARGO_BUILD_TARGET=i686-apple-darwin
29-
cargo +nightly test -Zbuild-std
30-
cargo +nightly test -Zbuild-std --features=$FEATURES
31-
cargo +nightly test -Zbuild-std --release
38+
#
39+
# Requires: `cargo install cargo-dinghy@0.6.8`
40+
export DINGHY_LOG=trace
41+
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std $CRATES
42+
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std $CRATES --features=unstable-static-class,unstable-static-sel
43+
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std $CRATES $FRAMEWORKS_IOS_9 --features=block2,exception,catch-all,all
44+
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std $CRATES --release

0 commit comments

Comments
 (0)