Various improvements to test scripts

This commit is contained in:
Simon Kågedal Reimer 2019-06-13 19:40:18 +02:00
parent 6486db2796
commit 80e130c339
2 changed files with 10 additions and 7 deletions

View File

@ -1,8 +1,13 @@
#!/bin/bash
if ! hash jq 2>/dev/null; then
echo "This script requires jq. Do brew install jq."
fi
DEVICE_TYPE=`xcrun simctl list devicetypes "iPhone 8" --json | jq '.devicetypes[0].identifier' --raw-output`
RUNTIME=`xcrun simctl list runtimes "iOS" --json | jq '.runtimes[0].identifier' --raw-output`
LOGO="🧪 "
DEVICE_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-7
RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-2
URL='https://localhost:1443/'
# HTTPS server
@ -13,7 +18,7 @@ HTTP_SERVER_PID=$!
# Create simulator
echo "${LOGO} Creating simulator"
echo "${LOGO} Creating simulator ($DEVICE_TYPE / $RUNTIME)"
UUID=`xcrun simctl create cert-test-iphone ${DEVICE_TYPE} ${RUNTIME}`
if [ $? -eq 0 ]; then
@ -42,7 +47,7 @@ read
# Opening the URL
echo "${LOGO} Opening ${URL} in simulator. This should now show the contents of this directory in Safari."
echo "${LOGO} Press enter when done."
echo "${LOGO} When confirmed, press enter to clean up, deleting this test simulator."
xcrun simctl openurl ${UUID} ${URL}
read

View File

@ -2,6 +2,4 @@
# This can be useful for testing the install-ca command
openssl genrsa -out test-ca.key 4096
openssl req -x509 -new -nodes -key test-ca.key -sha256 -days 1024 -out test-ca.crt
openssl req -x509 -newkey rsa:4096 -keyout test-ca.key -out test-ca.crt -days 365 -nodes -subj '/CN=localhost'