diff options
Diffstat (limited to 'dacapo/setup_dacapo.sh')
-rwxr-xr-x | dacapo/setup_dacapo.sh | 68 |
1 files changed, 54 insertions, 14 deletions
diff --git a/dacapo/setup_dacapo.sh b/dacapo/setup_dacapo.sh index ac94e60..8bb8db1 100755 --- a/dacapo/setup_dacapo.sh +++ b/dacapo/setup_dacapo.sh @@ -62,18 +62,50 @@ a provided destination directory. Options: -h Show this help message. - -d A path to the directory where to put all needed files. + -d Path to the AOSP tree root. + -u Uninstall only. " +# Remove existing DaCapo files +remove_existing() { + if [[ -d ${RUNNERS_DIR} ]]; then + info "Removing runners" + safe rm -r ${RUNNERS_DIR} + fi + if [[ -d ${FRAMEWORK_DIR} ]]; then + info "Removing framework code" + safe rm -r ${FRAMEWORK_DIR} + fi + if [[ -f ${LIB_DIR}/dacapo.jar ]]; then + info "Removing dacapo.jar" + safe rm ${LIB_DIR}/dacapo.jar + fi + if [[ -d ${DACAPO_RESOURCES_DIR} ]]; then + info "Removing resources" + safe rm -rf ${DACAPO_RESOURCES_DIR} + fi +} + +setup_dacapo_variables() { + readonly RUNNERS_DIR=${DEST_DIR}/benchmarks/benchmarks/dacapo + readonly FRAMEWORK_DIR=${DEST_DIR}/benchmarks/framework/benchmarks/dacapo + readonly DACAPO_RESOURCES_DIR=${DEST_DIR}/benchmarks/benchmarks/resources/dacapo + readonly LIB_DIR=${DEST_DIR}/benchmarks/benchmarks/lib +} + main() { - while getopts ":hd:" option; do + local UNINSTALL_ONLY=false + + while getopts ":hd:u" option; do if [[ ${OPTARG} == -* ]]; then exit_with_error "Option -${option} requires an argument." >&2 fi case "${option}" in h) info "${usage}"; exit ;; - d) DEST_DIR=${OPTARG} + d) DEST_DIR=${OPTARG}; + setup_dacapo_variables ;; + u) UNINSTALL_ONLY=true ;; \?) error "Illegal option: -${OPTARG}" >&2 error "${usage}" @@ -107,9 +139,26 @@ main() { cd $(dirname "$0") - # copy wrappers + + # uninstall DaCapo if it is already installed + info "Removing existing DaCapo files if possible" + remove_existing + if [[ ${UNINSTALL_ONLY} = true ]]; then + exit + fi + + # copy runners code info "Copying wrappers" - safe cp -r wrappers/dacapo ${DEST_DIR}/benchmarks/benchmarks + if [[ ! -d ${RUNNERS_DIR} ]]; then + safe mkdir -p ${RUNNERS_DIR} + fi + safe cp -r wrappers/dacapo/. ${RUNNERS_DIR} + + #copy framework code + if [[ ! -d ${FRAMEWORK_DIR} ]]; then + safe mkdir -p ${FRAMEWORK_DIR} + fi + safe cp -r framework/dacapo/. ${FRAMEWORK_DIR} # build DaCapo if [[ -d dacapo_src ]]; then @@ -149,20 +198,11 @@ main() { safe zip -d dacapo.jar /jar/derby.jar /jar/derbyclient.jar /jar/derbynet.jar /jar/derbytools.jar info "Copying dacapo.jar..." - local -r LIB_DIR=${DEST_DIR}/benchmarks/benchmarks/lib if [[ ! -d ${LIB_DIR} ]]; then safe mkdir -p ${LIB_DIR} - else - if [[ -f ${LIB_DIR}/dacapo.jar ]]; then - safe rm ${LIB_DIR}/dacapo.jar - fi fi safe cp dacapo.jar ${LIB_DIR}/ - local -r DACAPO_RESOURCES_DIR=${DEST_DIR}/benchmarks/benchmarks/resources/dacapo - if [[ -d ${DACAPO_RESOURCES_DIR} ]]; then - safe rm -rf ${DACAPO_RESOURCES_DIR} - fi safe mkdir -p ${DACAPO_RESOURCES_DIR}/dat safe mkdir -p ${DACAPO_RESOURCES_DIR}/cnf |