From 1be28e18561376c163cb76b69fa9585122cc6d98 Mon Sep 17 00:00:00 2001 From: "Mike JS. Choi" Date: Wed, 25 Jul 2018 17:16:50 +0900 Subject: [PATCH] Tests: Add script to download assets --- MobileVLCKit.xcodeproj/project.pbxproj | 31 ++++++++++++++++++++++ Tests/downloadTestAssets.sh | 36 ++++++++++++++++++++++++++ VLCKit.xcodeproj/project.pbxproj | 18 +++++++++++++ 3 files changed, 85 insertions(+) create mode 100755 Tests/downloadTestAssets.sh diff --git a/MobileVLCKit.xcodeproj/project.pbxproj b/MobileVLCKit.xcodeproj/project.pbxproj index 1f8641d4e..98a89ad91 100644 --- a/MobileVLCKit.xcodeproj/project.pbxproj +++ b/MobileVLCKit.xcodeproj/project.pbxproj @@ -975,6 +975,7 @@ isa = PBXNativeTarget; buildConfigurationList = CA0301D520ADFD2500452BB8 /* Build configuration list for PBXNativeTarget "MobileVLCKitTests" */; buildPhases = ( + CA738BF020F3487500901B26 /* ShellScript */, CA0301C720ADFD2500452BB8 /* Sources */, CA0301C820ADFD2500452BB8 /* Frameworks */, CA0301C920ADFD2500452BB8 /* Resources */, @@ -993,6 +994,7 @@ isa = PBXNativeTarget; buildConfigurationList = CAA03D1120C8DCDB001764DA /* Build configuration list for PBXNativeTarget "TVVLCKitTests" */; buildPhases = ( + CA738BF520F34D3400901B26 /* ShellScript */, CAA03D0320C8DCDA001764DA /* Sources */, CAA03D0420C8DCDA001764DA /* Frameworks */, CAA03D0520C8DCDA001764DA /* Resources */, @@ -1101,6 +1103,35 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + CA738BF020F3487500901B26 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "sh Tests/downloadTestAssets.sh\n"; + }; + CA738BF520F34D3400901B26 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "sh Tests/downloadTestAssets.sh\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 7D1329551BA304D900BE647E /* Sources */ = { isa = PBXSourcesBuildPhase; diff --git a/Tests/downloadTestAssets.sh b/Tests/downloadTestAssets.sh new file mode 100755 index 000000000..af16522ab --- /dev/null +++ b/Tests/downloadTestAssets.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Copyright (C) Mike JS. Choi, 2018 +# Copyright (C) 2018 VLC authors and VideoLAN + +set -e + +error() +{ + local red="\033[31m" + local normal="\033[0m" + echo "${red}error:${normal} $1" +} + +ASSET_DIR="Assets" + +PWD=$(pwd | xargs basename); + +if [ ${PWD} = "vlckit" ] || [ ${PWD} = "project" ] ; then + cd Tests +elif [ ${PWD} != "Tests" ]; then + error "Running program from unknown directory. Please move to project's root directory; vlckit" + exit 1 +fi + +if [ -d ${ASSET_DIR}/.git ]; then + cd ${ASSET_DIR} + git reset --hard + git pull origin master +else + git clone https://code.videolan.org/videolan/TestAssets.git ${ASSET_DIR} + + if [ $? -ne 0 ]; then + error "Please remove all files in vlckit/Tests/${ASSET_DIR} and try again" + exit 1 + fi +fi diff --git a/VLCKit.xcodeproj/project.pbxproj b/VLCKit.xcodeproj/project.pbxproj index c4c52def7..73ed29e55 100644 --- a/VLCKit.xcodeproj/project.pbxproj +++ b/VLCKit.xcodeproj/project.pbxproj @@ -621,6 +621,7 @@ isa = PBXNativeTarget; buildConfigurationList = CA23EBC420BDF02700C0D635 /* Build configuration list for PBXNativeTarget "VLCKitTests" */; buildPhases = ( + CA738BF820F3500A00901B26 /* Run Script */, CA23EBB820BDF02700C0D635 /* Sources */, CA23EBB920BDF02700C0D635 /* Frameworks */, CA23EBBA20BDF02700C0D635 /* Resources */, @@ -688,6 +689,23 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + CA738BF820F3500A00901B26 /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "sh Tests/downloadTestAssets.sh\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 7DC28D3D20194043002D05C4 /* Sources */ = { isa = PBXSourcesBuildPhase;