#!/bin/bash # # Kselftest Install # Install kselftest tests # Author: Shuah Khan # Copyright (C) 2015 Samsung Electronics Co., Ltd. # This software may be freely redistributed under the terms of the GNU # General Public License (GPLv2). global install_loc := $[pwd] proc main { if test $[basename $install_loc] != "selftests" { echo "$0: Please run it in selftests directory ..." exit 1; } if test "$Argc" -eq 0 { echo "$0: Installing in default location - $install_loc ..." } elif test ! -d $1 { echo "$0: $1 doesn't exist!!" exit 1; } else { global install_loc := $1 echo "$0: Installing in specified location - $install_loc ..." } global install_dir := "$install_loc/kselftest" # Create install directory mkdir -p $install_dir # Build tests env INSTALL_PATH=$install_dir make install } main @Argv (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_loc) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: spids: [27 29] ) } spids: [26] ) ] spids: [26] ) (FuncDef name: main body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (CommandSubPart command_list: (CommandList children: [(C {(basename)} {($ VSub_Name "$install_loc")})] ) left_token: spids: [43 47] ) } {(KW_Bang "!") (Lit_Other "=")} {(DQ (selftests))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} {(DQ ($ VSub_Number "$0") (": Please run it in selftests directory ..."))} ) (Sentence child:(C {(exit)} {(1)}) terminator:) ] spids: [-1 59] ) ] spids: [-1 76] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Pound "$#"))} {(-eq)} {(0)} {(Lit_Other "]")}) terminator: ) ] action: [ (C {(echo)} { (DQ ($ VSub_Number "$0") (": Installing in default location - ") ($ VSub_Name "$install_loc") (" ...") ) } ) ] spids: [-1 94] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} {(DQ ($ VSub_Number "$0") (": ") ($ VSub_Number "$1") (" doesn't exist!!"))} ) (Sentence child:(C {(exit)} {(1)}) terminator:) ] spids: [107 122] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_loc) op: Equal rhs: {($ VSub_Number "$1")} spids: [144] ) ] spids: [144] ) (C {(echo)} { (DQ ($ VSub_Number "$0") (": Installing in specified location - ") ($ VSub_Name "$install_loc") (" ...") ) } ) ] spids: [141 158] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_dir) op: Equal rhs: {($ VSub_Name "$install_loc") (/kselftest)} spids: [162] ) ] spids: [162] ) (C {(mkdir)} {(-p)} {($ VSub_Name "$install_dir")}) (SimpleCommand words: [{(make)} {(install)}] more_env: [(env_pair name:INSTALL_PATH val:{($ VSub_Name "$install_dir")} spids:[181])] ) ] spids: [36] ) spids: [32 35] ) (C {(main)} {(DQ ($ VSub_At "$@"))}) ] )