aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-02-20 06:26:05 +0000
committerPeter Mikus <pmikus@cisco.com>2019-02-20 06:26:05 +0000
commit8577b4441fd99d1db694e6e9f07801c35ac17748 (patch)
treea2369ebb785e38e565240fa581bc66c7ff23bca7 /resources/libraries
parentfa0fe5c805169951c466d3b18091c0cfc52dd5ca (diff)
FIX: Static variables all over the place for per patch
- Incredible why is it so hard to write scripts not hardcoding anything. Change-Id: I48cf2cc3d25f9665a9ff7ca26756d3b70cdd2f9c Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/bash/entry/per_patch_device.sh2
-rw-r--r--resources/libraries/bash/function/per_patch.sh35
2 files changed, 26 insertions, 11 deletions
diff --git a/resources/libraries/bash/entry/per_patch_device.sh b/resources/libraries/bash/entry/per_patch_device.sh
index 3f52bcbc0b..11203316fb 100644
--- a/resources/libraries/bash/entry/per_patch_device.sh
+++ b/resources/libraries/bash/entry/per_patch_device.sh
@@ -53,5 +53,5 @@ select_vpp_device_tags || die
compose_pybot_arguments || die
run_pybot || die
copy_archives || die
-archive_parse_test_results "csit_current" || die
+archive_test_results "csit_current" || die
die_on_pybot_error || die
diff --git a/resources/libraries/bash/function/per_patch.sh b/resources/libraries/bash/function/per_patch.sh
index 83e8427824..27fa0cfb06 100644
--- a/resources/libraries/bash/function/per_patch.sh
+++ b/resources/libraries/bash/function/per_patch.sh
@@ -13,20 +13,19 @@
set -exuo pipefail
-# This library defines functions used mainly by "per_patch_perf.sh" entry script.
+# This library defines functions used mainly by per patch entry scripts.
# Generally, the functions assume "common.sh" library has been sourced already.
# Keep functions ordered alphabetically, please.
-# TODO: Add a link to bash style guide.
-
-
-function archive_parse_test_results () {
+function archive_test_results () {
set -exuo pipefail
# Arguments:
# - ${1}: Directory to archive to. Required. Parent has to exist.
+ # Variable set:
+ # - TARGET - Target directory.
# Variables read:
# - ARCHIVE_DIR - Path to where robot result files are created in.
# - VPP_DIR - Path to existing directory, root for to relative paths.
@@ -34,17 +33,33 @@ function archive_parse_test_results () {
# - ${1} - Created, and robot and parsing files are moved/created there.
# Functions called:
# - die - Print to stderr and exit, defined in common.sh
- # - parse_bmrr_results - See definition in this file.
cd "${VPP_DIR}" || die "Change directory command failed."
- target="$(readlink -f "$1")"
- mkdir -p "${target}" || die "Directory creation failed."
+ TARGET="$(readlink -f "$1")"
+ mkdir -p "${TARGET}" || die "Directory creation failed."
for filename in "output.xml" "log.html" "report.html"; do
- mv "${ARCHIVE_DIR}/${filename}" "${target}/${filename}" || {
+ mv "${ARCHIVE_DIR}/${filename}" "${TARGET}/${filename}" || {
die "Attempt to move '${filename}' failed."
}
done
- parse_bmrr_results "${target}" || {
+}
+
+
+function archive_parse_test_results () {
+
+ set -exuo pipefail
+
+ # Arguments:
+ # - ${1}: Directory to archive to. Required. Parent has to exist.
+ # Variables read:
+ # - TARGET - Target directory.
+ # Functions called:
+ # - die - Print to stderr and exit, defined in common.sh
+ # - archive_test_results - Archiving results.
+ # - parse_bmrr_results - See definition in this file.
+
+ archive_test_results "$1" || die
+ parse_bmrr_results "${TARGET}" || {
die "The function should have died on error."
}
}
class="n">F) #undef F LLDP_N_ERROR, } lldp_error_t; /* lldp packet trace capture */ typedef struct { u32 len; u8 data[400]; } lldp_input_trace_t; typedef enum { LLDP_EVENT_RESCHEDULE = 1, } lldp_process_event_t; lldp_intf_t *lldp_get_intf (lldp_main_t * lm, u32 hw_if_index); lldp_intf_t *lldp_create_intf (lldp_main_t * lm, u32 hw_if_index); void lldp_delete_intf (lldp_main_t * lm, lldp_intf_t * n); lldp_error_t lldp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0); u8 *lldp_input_format_trace (u8 * s, va_list * args); void lldp_send_ethernet (lldp_main_t * lm, lldp_intf_t * n, int shutdown); void lldp_schedule_intf (lldp_main_t * lm, lldp_intf_t * n); void lldp_unschedule_intf (lldp_main_t * lm, lldp_intf_t * n); #endif /* __included_lldp_node_h__ */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */