aboutsummaryrefslogtreecommitdiffstats
path: root/docs/testing/user/userguide/index.rst
blob: bfe8c95b246ae9fa21821df937455b1fa81efbed (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.. SPDX-License-Identifier: CC-BY-4.0

.. _functest-userguide:

*******************
Functest User Guide
*******************

.. toctree::
   :maxdepth: 2

   intro.rst
   test_overview.rst
   test_details.rst
   runfunctest.rst
   test_results.rst
   reporting.rst
   troubleshooting.rst


References
==========

`[2]`_: OpenStack Tempest documentation

`[3]`_: Rally documentation

`[4]`_: Functest in depth (Danube)

`[5]`_: Clearwater vIMS blueprint

`[6]`_: Security Content Automation Protocol

`[7]`_: OpenSCAP web site

`[8]`_: Refstack client

`[9]`_: Defcore

`[10]`_: OpenStack interoperability procedure

`[11]`_: Robot Framework web site

`[13]`_: SNAPS wiki

`[14]`_: vRouter

`[15]`_: Testing OpenStack Tempest part 1

`[16]`_: OPNFV Test API

`OPNFV main site`_: OPNFV official web site

`Functest page`_: Functest wiki page

IRC support chan: #opnfv-functest

.. _`[2]`: http://docs.openstack.org/developer/tempest/overview.html
.. _`[3]`: https://rally.readthedocs.org/en/latest/index.html
.. _`[4]`: http://events.linuxfoundation.org/sites/events/files/slides/Functest%20in%20Depth_0.pdf
.. _`[5]`: https://github.com/Orange-OpenSource/opnfv-cloudify-clearwater/blob/master/openstack-blueprint.yaml
.. _`[6]`: https://en.wikipedia.org/wiki/Security_Content_Automation_Protocol
.. _`[7]`: https://github.com/OpenSCAP/openscap
.. _`[8]`: https://github.com/openstack/refstack-client
.. _`[9]`: https://github.com/openstack/defcore
.. _`[10]`: https://github.com/openstack/interop/blob/master/2016.08/procedure.rst
.. _`[11]`: http://robotframework.org/
.. _`[13]`: https://wiki.opnfv.org/display/PROJ/SNAPS-OO
.. _`[14]`: https://github.com/oolorg/opnfv-functest-vrouter
.. _`[15]`: https://aptira.com/testing-openstack-tempest-part-1/
.. _`[16]`: http://testresults.opnfv.org/test/
.. _`OPNFV main site`: http://www.opnfv.org
.. _`Functest page`: https://wiki.opnfv.org/display/functest/Opnfv+Functional+Testing
.. _`OpenRC`: http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html
.. _`Rally installation procedure`: https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
.. _`config_functest.yaml` : https://github.com/opnfv/functest/blob/master/functest/ci/config_functest.yaml
.. _`Functest reporting`: http://testresults.opnfv.org/reporting/master/functest/status-apex.html
class="cm">// // 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. */ #include "clock.h" #include <stdio.h> #include <string.h> #include <rte_cycles.h> /* Calibrate TSC overhead by reading NB_READ times and take the smallest value. Bigger values are caused by external influence and can be discarded. The best estimate is the smallest read value. */ #define NB_READ 10000 uint32_t rdtsc_overhead; uint32_t rdtsc_overhead_stats; uint64_t thresh; uint64_t tsc_hz; /* calculate how much overhead is involved with calling rdtsc. This value has to be taken into account where the time spent running a small piece of code is measured */ static void init_tsc_overhead(void) { volatile uint32_t min_without_overhead = UINT32_MAX; volatile uint32_t min_with_overhead = UINT32_MAX; volatile uint32_t min_stats_overhead = UINT32_MAX; volatile uint64_t start1, end1; volatile uint64_t start2, end2; for (uint32_t i = 0; i < NB_READ; ++i) { start1 = rte_rdtsc(); end1 = rte_rdtsc(); start2 = rte_rdtsc(); end2 = rte_rdtsc(); end2 = rte_rdtsc(); if (min_without_overhead > end1 - start1) { min_without_overhead = end1 - start1; } if (min_with_overhead > end2 - start2) { min_with_overhead = end2 - start2; } } rdtsc_overhead = min_with_overhead - min_without_overhead; start1 = rte_rdtsc(); end1 = rte_rdtsc(); /* forbid the compiler to optimize this dummy variable */ volatile int dummy = 0; for (uint32_t i = 0; i < NB_READ; ++i) { start1 = rte_rdtsc(); dummy += 32; end1 = rte_rdtsc(); if (min_stats_overhead > end2 - start2) { min_stats_overhead = end1 - start1; } } rdtsc_overhead_stats = rdtsc_overhead + min_stats_overhead - min_without_overhead; } void clock_init(void) { init_tsc_overhead(); tsc_hz = rte_get_tsc_hz(); thresh = UINT64_MAX/tsc_hz; } uint64_t str_to_tsc(const char *from) { const uint64_t hz = rte_get_tsc_hz(); uint64_t ret; char str[16]; strncpy(str, from, sizeof(str)); char *frac = strchr(str, '.'); if (frac) { *frac = 0; frac++; } ret = hz * atoi(str); if (!frac) return ret; uint64_t nsec = 0; uint64_t multiplier = 100000000; for (size_t i = 0; i < strlen(frac); ++i) { nsec += (frac[i] - '0') * multiplier; multiplier /= 10; } /* Wont overflow until CPU freq is ~18.44 GHz */ ret += hz * nsec/1000000000; return ret; } uint64_t sec_to_tsc(uint64_t sec) { if (sec < UINT64_MAX/rte_get_tsc_hz()) return sec * rte_get_tsc_hz(); else return UINT64_MAX; } uint64_t msec_to_tsc(uint64_t msec) { if (msec < UINT64_MAX/rte_get_tsc_hz()) return msec * rte_get_tsc_hz() / 1000; else return msec / 1000 * rte_get_tsc_hz(); } uint64_t usec_to_tsc(uint64_t usec) { if (usec < UINT64_MAX/rte_get_tsc_hz()) return usec * rte_get_tsc_hz() / 1000000; else return usec / 1000000 * rte_get_tsc_hz(); } uint64_t nsec_to_tsc(uint64_t nsec) { if (nsec < UINT64_MAX/rte_get_tsc_hz()) return nsec * rte_get_tsc_hz() / 1000000000; else return nsec / 1000000000 * rte_get_tsc_hz(); } uint64_t tsc_to_msec(uint64_t tsc) { if (tsc < UINT64_MAX / 1000) { return tsc * 1000 / rte_get_tsc_hz(); } else { return tsc / (rte_get_tsc_hz() / 1000); } } uint64_t tsc_to_usec(uint64_t tsc) { if (tsc < UINT64_MAX / 1000000) { return tsc * 1000000 / rte_get_tsc_hz(); } else { return tsc / (rte_get_tsc_hz() / 1000000); } } uint64_t tsc_to_nsec(uint64_t tsc) { if (tsc < UINT64_MAX / 1000000000) { return tsc * 1000000000 / rte_get_tsc_hz(); } else { return tsc / (rte_get_tsc_hz() / 1000000000); } } uint64_t tsc_to_sec(uint64_t tsc) { return tsc / rte_get_tsc_hz(); } struct time_unit tsc_to_time_unit(uint64_t tsc) { struct time_unit ret; uint64_t hz = rte_get_tsc_hz(); ret.sec = tsc/hz; ret.nsec = (tsc - ret.sec*hz)*1000000000/hz; return ret; } uint64_t time_unit_to_usec(struct time_unit *time_unit) { return time_unit->sec * 1000000 + time_unit->nsec/1000; } uint64_t time_unit_to_nsec(struct time_unit *time_unit) { return time_unit->sec * 1000000000 + time_unit->nsec; } int time_unit_cmp(struct time_unit *left, struct time_unit *right) { if (left->sec < right->sec) return -1; if (left->sec > right->sec) return 1; if (left->nsec < right->nsec) return -1; if (left->nsec > right->nsec) return -1; return 0; } uint64_t freq_to_tsc(uint64_t times_per_sec) { return rte_get_tsc_hz()/times_per_sec; } void tsc_to_tv(struct timeval *tv, const uint64_t tsc) { uint64_t hz = rte_get_tsc_hz(); uint64_t sec = tsc/hz; tv->tv_sec = sec; tv->tv_usec = ((tsc - sec * hz) * 1000000) / hz; } void tv_to_tsc(const struct timeval *tv, uint64_t *tsc) { uint64_t hz = rte_get_tsc_hz(); *tsc = tv->tv_sec * hz; *tsc += tv->tv_usec * hz / 1000000; } struct timeval tv_diff(const struct timeval *cur, const struct timeval *next) { uint64_t sec, usec; sec = next->tv_sec - cur->tv_sec; if (next->tv_usec < cur->tv_usec) { usec = next->tv_usec + 1000000 - cur->tv_usec; sec -= 1; } else usec = next->tv_usec - cur->tv_usec; struct timeval ret = { .tv_sec = sec, .tv_usec = usec, }; return ret; }