Skip to content

Commit

Permalink
Update local test script and fix a few tests
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Apr 17, 2024
1 parent 71c243f commit 7ac4f9d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
2 changes: 2 additions & 0 deletions crates/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ all = [
"objc2-foundation/NSDictionary",
"objc2-foundation/NSValue",
"objc2-foundation/NSObject",
"objc2-foundation/NSEnumerator",
"objc2-foundation/NSObjCRuntime",
]

apple = ["block2/apple", "objc2/apple", "objc2-foundation/apple"]
Expand Down
1 change: 1 addition & 0 deletions framework-crates/objc2-foundation/src/tests/exception.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![cfg(feature = "NSException")]
#![cfg(feature = "NSString")]
#![cfg(feature = "NSDictionary")]
#![cfg(feature = "NSObjCRuntime")]
use alloc::format;

use crate::Foundation::{NSException, NSObject, NSString};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn test_into_vec() {
}

#[test]
#[cfg(feature = "NSString")]
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
fn test_sort() {
use Foundation::NSString;

Expand Down
43 changes: 28 additions & 15 deletions helper-scripts/test-local.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@
#!/bin/bash
# A test script I use to test on my local devices

set -euxo pipefail

export CARGO_TARGET_DIR=$HOME/Desktop/objc2-target
export MACOSX_DEPLOYMENT_TARGET=10.12
export IPHONEOS_DEPLOYMENT_TARGET=10.0
export FEATURES=std,block,exception,catch-all,unstable-static-class,unstable-static-sel
export CRATES='--package=block2 --package=objc-sys --package=objc2 --package=objc2-encode --package=objc2-proc-macros --package=tests'
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'
export FRAMEWORKS_IOS_9='--package=objc2-foundation --package=objc2-metal'

# Test on macOS 32bit
export SDKROOT=$HOME/Desktop/MacOSX10.13.sdk
cargo test $CRATES
cargo test $CRATES --features=unstable-static-class,unstable-static-sel
cargo test $CRATES $FRAMEWORKS_MACOS_10_13 --features=block2,exception,catch-all,all
cargo test $CRATES --release
cargo test -Zbuild-std --target=i686-apple-darwin $CRATES
cargo test -Zbuild-std --target=i686-apple-darwin $CRATES $FRAMEWORKS_MACOS_10_13 --features=block2,exception,catch-all,all
cargo test -Zbuild-std --target=i686-apple-darwin $CRATES --release
unset SDKROOT

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

# Test on the simulator
cargo dinghy --device sim test
cargo dinghy --device sim test --features=$FEATURES
cargo dinghy --device sim test --release
IPHONEOS_DEPLOYMENT_TARGET=10.0 cargo dinghy --device sim test $CRATES
IPHONEOS_DEPLOYMENT_TARGET=10.0 cargo dinghy --device sim test $CRATES --features=unstable-static-class,unstable-static-sel
IPHONEOS_DEPLOYMENT_TARGET=10.0 cargo dinghy --device sim test $CRATES $FRAMEWORKS_IOS_9 --features=block2,exception,catch-all,all
IPHONEOS_DEPLOYMENT_TARGET=10.0 cargo dinghy --device sim test $CRATES --release

# Test on my iPad mini 1st generation iOS 9.3
# Followed this guide to set it up:
# https://github.com/sonos/dinghy/blob/main/docs/ios.md
#
# We use build-std and earlier nightly because the target is armv7-apple-ios, which was removed in:
# https://github.com/rust-lang/rust/pull/104385
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std --features=$FEATURES
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std --release

# Test on macOS 32bit
export SDKROOT=(pwd)/ideas/MacOSX10.13.sdk
export CARGO_BUILD_TARGET=i686-apple-darwin
cargo +nightly test -Zbuild-std
cargo +nightly test -Zbuild-std --features=$FEATURES
cargo +nightly test -Zbuild-std --release
#
# Requires: `cargo install [email protected]`
export DINGHY_LOG=trace
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std $CRATES
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std $CRATES --features=unstable-static-class,unstable-static-sel
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
IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std $CRATES --release

0 comments on commit 7ac4f9d

Please sign in to comment.