add ifdef guard to .h file
authorYaroslav Brustinov <[email protected]>
Sun, 30 Oct 2016 14:10:59 +0000 (16:10 +0200)
committerYaroslav Brustinov <[email protected]>
Sun, 30 Oct 2016 19:00:40 +0000 (21:00 +0200)
remove UUID from TUI
STF Python API: show newlines instead of "\n\n\n" in Exception message
STF Python API: remove "During handling of the above exception, another exception occurred:" in Python3.3+
dpdk_nic_bind.py: ensure needed PATH exists for lspci etc.
t-rex-64: remove "stty: standard input: Inappropriate ioctl for device"
t-rex-64: remove "cat: write error: Broken pipe"

Signed-off-by: Yaroslav Brustinov <[email protected]>
scripts/automation/regression/trex_unit_test.py
scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_exceptions.py
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
scripts/dpdk_nic_bind.py
scripts/t-rex-64
src/pal/linux/rte_ethdev_includes.h

index 1f066fa..cd19c79 100755 (executable)
@@ -180,20 +180,14 @@ class CTRexTestConfiguringPlugin(Plugin):
         CTRexScenario.test  = options.test
         if self.collect_only or self.functional:
             return
-        
         if CTRexScenario.setup_dir and options.config_path:
             raise Exception('Please either define --cfg or use env. variable SETUP_DIR, not both.')
-
-        if not CTRexScenario.setup_dir and not options.config_path:
-            raise Exception('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR')
-
-        if not options.config_path:
+        if not options.config_path and CTRexScenario.setup_dir:
             options.config_path = CTRexScenario.setup_dir
-        if not CTRexScenario.setup_dir:
-            CTRexScenario.setup_dir = options.config_path
-        
-        CTRexScenario.setup_name = os.path.basename(CTRexScenario.setup_dir)
-
+        if not options.config_path:
+            raise Exception('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR')
+        options.config_path = options.config_path.rstrip('/')
+        CTRexScenario.setup_name = os.path.basename(options.config_path)
         self.configuration = misc_methods.load_complete_config_file(os.path.join(options.config_path, 'config.yaml'))
         self.configuration.trex['trex_name'] = address_to_ip(self.configuration.trex['trex_name']) # translate hostname to ip
         self.benchmark     = misc_methods.load_benchmark_config_file(os.path.join(options.config_path, 'benchmark.yaml'))
@@ -327,6 +321,7 @@ if __name__ == "__main__":
     if not CTRexScenario.setup_dir:
         CTRexScenario.setup_dir = check_setup_path(os.path.join('setups', setup_dir))
 
+
     nose_argv = ['', '-s', '-v', '--exe', '--rednose', '--detailed-errors']
     test_client_package = False
     if '--test-client-package' in sys.argv:
index ecf6083..e9d2b8a 100755 (executable)
@@ -1087,7 +1087,9 @@ class CTRexClient(object):
         """
         # handle known exceptions based on known error codes.
         # if error code is not known, raise ProtocolError
-        raise exception_handler.gen_exception(err)
+        exc = exception_handler.gen_exception(err)
+        exc.__cause__ = None # remove "During handling of the above exception, another exception occurred:" in Python3.3+
+        raise exc
 
 
 class CTRexResult(object):
index 0de3841..89134e7 100755 (executable)
@@ -19,11 +19,12 @@ class RPCError(Exception):
 
     def __str__(self):
         return self.__repr__()
+
     def __repr__(self):
         if self.args[2] is not None:
-            return u"[errcode:%r] %r. Extended data: %r" % (self.args[0], self.args[1], self.args[2])
+            return u"[errcode:%s] %s. Extended data: %s" % self.args
         else:
-            return u"[errcode:%r] %r" % (self.args[0], self.args[1])
+            return u"[errcode:%s] %s" % self.args[:2]
 
 class TRexException(RPCError):
     """ 
index 875ad24..9f60148 100644 (file)
@@ -217,8 +217,7 @@ class CTRexInfoGenerator(object):
      
         stats_data_left = OrderedDict([("connection", "{host}, Port {port}".format(host=global_stats.connection_info.get("server"),
                                                                      port=global_stats.connection_info.get("sync_port"))),
-                             ("version", "{ver}, UUID: {uuid}".format(ver=global_stats.server_version.get("version", "N/A"),
-                                                                      uuid="N/A")),
+                             ("version", "{ver}".format(ver=global_stats.server_version.get("version", "N/A"))),
 
                              ("cpu_util.", "{0}% @ {2} cores ({3} per port) {1}".format( format_threshold(round_float(global_stats.get("m_cpu_util")), [85, 100], [0, 85]),
                                                                                          global_stats.get_trend_gui("m_cpu_util", use_raw = True),
index ed0462e..a85ecb7 100755 (executable)
@@ -45,6 +45,10 @@ import getpass
 
 # The PCI device class for ETHERNET devices
 ETHERNET_CLASS = "0200"
+PATH = os.getenv('PATH', '')
+needed_path = '.:/bin:/usr/bin:/usr/sbin'
+if needed_path not in PATH:
+    os.environ['PATH'] = '%s:%s' % (PATH, needed_path)
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
index 4d0d781..d2388cf 100755 (executable)
@@ -24,9 +24,16 @@ done <<< "$($PYTHON dpdk_setup_ports.py --dump-pci-description)"
 
 cd $(dirname $0)
 export LD_LIBRARY_PATH=$PWD
-saveterm="$(stty -g)"
+
+if [ -t 0 ] && [ -t 1 ]; then
+    export is_tty=true
+    saveterm="$(stty -g)"
+else
+    export is_tty=false
+fi
+
 # if we have a new core run optimized trex 
-if  cat /proc/cpuinfo | grep -q avx ; then
+if  grep -q avx /proc/cpuinfo ; then
     ./_$(basename $0) $INPUT_ARGS
     RESULT=$?
     if [ $RESULT -eq 132 ]; then
@@ -40,7 +47,10 @@ else
         ./_t-rex-64-o $INPUT_ARGS
         RESULT=$?
 fi
-stty $saveterm  
+
+if $is_tty; then
+    stty $saveterm
+fi
 
 if [ $RESULT -ne 0 ]; then
   exit $RESULT
index de115d7..e957b68 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef __RTE_ETHDEV_INCLUDES_H__
+#define __RTE_ETHDEV_INCLUDES_H__
+
 struct rte_eth_link {
     int link_autoneg;
     int link_speed;
@@ -21,3 +24,4 @@ struct rte_eth_fc_conf {
 struct rte_eth_dev_info {
 };
 
+#endif /* __RTE_ETHDEV_INCLUDES_H__ */