From 37a9451377f7239365b5af778b8072d1585a2d2a Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Wed, 14 Aug 2019 12:30:06 +0000 Subject: Move: WRK installation into ansible - Remove ability to install from framework. - Control via ansible with other dependencies. Signed-off-by: Peter Mikus Change-Id: I5fd0ca18b4f76c30b6c28b4dcd15e538e01cb315 --- resources/tools/wrk/wrk_utils.sh | 64 +++++++--------------------------------- 1 file changed, 10 insertions(+), 54 deletions(-) (limited to 'resources/tools/wrk/wrk_utils.sh') diff --git a/resources/tools/wrk/wrk_utils.sh b/resources/tools/wrk/wrk_utils.sh index 2b9f6cf296..1c77fea731 100755 --- a/resources/tools/wrk/wrk_utils.sh +++ b/resources/tools/wrk/wrk_utils.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2018 Cisco and/or its affiliates. +# Copyright (c) 2019 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -14,59 +14,19 @@ set -x -WRK_VERSION="4.0.2" -WRK_TAR=${WRK_VERSION}".tar.gz" -WRK_DWNLD_PATH="https://github.com/wg/wrk/archive" -WRK_TARGET="/opt" -WRK_INSTALL_DIR=${WRK_TARGET}/wrk-${WRK_VERSION} +function wrk_utils.installed { -function wrk_utils.install { - # Install wrk + # Check if the WRK utility is installed. Fail if not installed. - # Directory for wrk: - dir=${1} - # Force the installation: - force=${2:-false} + # Returns: + # - 0 - If command is installed. + # - 1 - If command is not installed. - # Check if wrk is installed: - if [ "${force}" = true ]; then - wrk_utils.destroy - else - which wrk - if [ $? -eq 0 ]; then - test -d ${dir}/${WRK_INSTALL_DIR} && echo "WRK already installed: ${dir}/${WRK_INSTALL_DIR}" && exit 0 - fi - fi - - # Install pre-requisites: - apt-get update - apt-get install build-essential libssl-dev -y - - # Remove previous installation: - wrk_utils.destroy - - # Change the directory: - cd ${WRK_TARGET} + set -exuo pipefail - # Get the specified version: - wget ${WRK_DWNLD_PATH}/${WRK_TAR} - tar xzf ${WRK_TAR} - rm ${WRK_TAR} - cd ${WRK_INSTALL_DIR} - - # Build the wrk: - make - - # Move the executable to somewhere in the PATH: - cp wrk /usr/local/bin + command -v wrk } -function wrk_utils.destroy { - # Remove wrk - - sudo rm /usr/local/bin/wrk || true - sudo rm -rf ${WRK_INSTALL_DIR} || true -} function wrk_utils.traffic_1_url_1_core { # Send traffic @@ -271,12 +231,8 @@ function wrk_utils.traffic_n_urls_m_cores { args=("$@") case ${1} in - install) - force=${2} - wrk_utils.install ${force} - ;; - destroy) - wrk_utils.destroy + installed) + wrk_utils.installed ;; traffic_1_url_1_core) wrk_utils.traffic_1_url_1_core "${args[@]:1}" -- cgit 1.2.3-korg 8420e590eaa4672420b91e2161b5'>treecommitdiffstats
blob: f4cca0946e8ba3a093761a2ab0b8e090a224856b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38