Codebase list libcorkipset / 09b5022
Merge remote-tracking branch 'template/c-template' into develop John Zachary 10 years ago
18 changed file(s) with 289 addition(s) and 667 deletion(s). Raw diff Collapse all Expand all
88
99 cmake_minimum_required(VERSION 2.6)
1010 set(PROJECT_NAME ipset)
11 set(RELEASE_DATE 2013-12-11)
1112 project(${PROJECT_NAME})
1213 enable_testing()
1314
2021 OUTPUT_VARIABLE VERSION
2122 OUTPUT_STRIP_TRAILING_WHITESPACE)
2223 if(VERSION_RESULT)
23 message(FATAL_ERROR "Cannot determine version number")
24 message(FATAL_ERROR
25 "Cannot determine version number: " ${VERSION_RESULT})
2426 endif(VERSION_RESULT)
2527 # This causes an annoying extra prompt in ccmake.
2628 # message("Current version: " ${VERSION})
2729
2830 string(REGEX REPLACE "-dev.*" "-dev" BASE_VERSION "${VERSION}")
2931
32 find_package(PkgConfig)
33
34 #-----------------------------------------------------------------------
35 # Check for building on Tilera
36 # If the Tilera environment is installed, then $TILERA_ROOT is defined
37 # as the path to the active MDE.
38
39 if(DEFINED ENV{TILERA_ROOT})
40 set(TILERA TRUE)
41 set(TILERA_ROOT $ENV{TILERA_ROOT})
42 message("-- Configuring for Tilera MDE ${TILERA_ROOT}")
43 set(ENV{PKG_CONFIG_PATH}
44 "${TILERA_ROOT}/tile/usr/lib/pkgconfig:${TILERA_ROOT}/tile/usr/local/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
45 )
46 set(CMAKE_SYSTEM_NAME "Tilera")
47 set(CMAKE_SYSTEM_PROCESSOR "tilegx")
48 set(CMAKE_C_COMPILER "${TILERA_ROOT}/bin/tile-gcc")
49 set(CMAKE_LINKER "${TILERA_ROOT}/bin/tile-ld")
50 set(TILERA_MONITOR "${TILERA_ROOT}/bin/tile-monitor")
51 #add_definitions(-std=gnu99)
52 set(CMAKE_FIND_ROOT_PATH "${TILERA_ROOT}/tile")
53 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
54 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
55 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
56 endif()
57
3058 #-----------------------------------------------------------------------
3159 # Check for prerequisite libraries
32
33 find_package(PkgConfig)
3460
3561 pkg_check_modules(CORK REQUIRED "libcork >= 0.12.0")
3662 include_directories(${CORK_INCLUDE_DIRS})
5177 FORCE)
5278 endif(NOT CMAKE_BUILD_TYPE)
5379
54 if(CMAKE_COMPILER_IS_GNUCC)
80 set(CMAKE_INSTALL_LIBDIR lib CACHE STRING
81 "The base name of the installation directory for libraries")
82
83 if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
5584 add_definitions(-Wall -Werror)
56 endif(CMAKE_COMPILER_IS_GNUCC)
85 elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
86 add_definitions(-Wall -Werror)
87 elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel")
88 add_definitions(-Wall -Werror)
89 endif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
5790
5891 #-----------------------------------------------------------------------
5992 # Include our subdirectories
6093
6194 add_subdirectory(docs)
6295 add_subdirectory(include)
96 add_subdirectory(share)
6397 add_subdirectory(src)
6498 add_subdirectory(examples)
6599 add_subdirectory(tests)
00 # -*- coding: utf-8 -*-
11 # ----------------------------------------------------------------------
2 # Copyright © 2011, RedJack, LLC.
2 # Copyright © 2011-2013, RedJack, LLC.
33 # All rights reserved.
44 #
55 # Please see the LICENSE.txt file in this distribution for license
66 # details.
77 # ----------------------------------------------------------------------
88
9 find_program(
10 SPHINX_EXECUTABLE
11 NAMES sphinx-build
12 HINTS ENV SPHINX_DIR
13 PATH_SUFFIXES bin
14 DOC "Sphinx documentation generator"
9 # Fill in this with the text that you want to include in the header and footer
10 # of each man page.
11
12 set(MAN_HEADER "Ipset documentation")
13 set(MAN_FOOTER "Ipset")
14
15 # Fill this in with any man pages that should be built from a pandoc source
16 # file. For a man page called foo.5, there should be a pandoc source file
17 # called foo.5.pandoc.
18
19 set(MAN_PAGES
1520 )
1621
17 set(GENERATE_DOC TRUE)
22 #-----------------------------------------------------------------------
23 # Everything below is boilerplate!
1824
19 if (NOT SPHINX_EXECUTABLE)
20 message(WARNING "Unable to find Sphinx documentation generator")
21 set(GENERATE_DOC FALSE)
22 endif (NOT SPHINX_EXECUTABLE)
25 find_program(
26 PANDOC_EXECUTABLE
27 NAMES pandoc
28 HINTS ENV PANDOC_DIR
29 PATH_SUFFIXES bin
30 DOC "Pandoc man page generator"
31 )
2332
24 set(INTERSPHINX_OVERRIDES "")
33 set(GENERATE_DOC TRUE CACHE BOOL
34 "Whether to rebuild documentation")
2535
26 macro(find_prereq_doc LIB_NAME)
27 execute_process(
28 COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=sphinxdir ${LIB_NAME}
29 OUTPUT_VARIABLE LIB_SPHINX_DIR
30 OUTPUT_STRIP_TRAILING_WHITESPACE
31 )
36 if (NOT PANDOC_EXECUTABLE)
37 message(WARNING "Unable to find pandoc documentation generator")
38 set(GENERATE_DOC FALSE)
39 endif (NOT PANDOC_EXECUTABLE)
3240
33 if (LIB_SPHINX_DIR)
34 message(STATUS "Using ${LIB_NAME} docs in ${LIB_SPHINX_DIR}")
35 set(
36 INTERSPHINX_OVERRIDES
37 "${INTERSPHINX_OVERRIDES}\nintersphinx_mapping['${LIB_NAME}'] = ('${LIB_SPHINX_DIR}', None)"
41
42 # Link man pages go in docs/links
43
44 macro(install_links section)
45 file(GLOB links "links/*.${section}")
46 if (links)
47 install(
48 FILES ${links}
49 DESTINATION "share/man/man${section}"
50 )
51 endif (links)
52 endmacro(install_links section)
53
54 install_links(1) # commands
55 install_links(3) # library API
56 install_links(4) # special files and drivers
57 install_links(5) # file formats and conventions
58 install_links(7) # miscellaneous
59 install_links(8) # system commands
60
61
62 # Man pages with actual content go in docs
63
64 set(ALL_MANS)
65
66 macro(pandocify name)
67 set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}.pandoc")
68 set(dest "${CMAKE_CURRENT_SOURCE_DIR}/${name}")
69 get_filename_component(section "${name}" EXT)
70 string(REPLACE "." "" section "${section}")
71
72 # Only compile the markdown source into groff man pages if requested.
73 if (GENERATE_DOC)
74 add_custom_command(
75 OUTPUT ${dest}
76 COMMAND ${PANDOC_EXECUTABLE}
77 -f markdown -t man -s --smart
78 -V header="${MAN_HEADER}"
79 -V footer="${MAN_FOOTER}"
80 -V date=${RELEASE_DATE}
81 -o ${dest} ${src}
82 MAIN_DEPENDENCY ${src}
83 COMMENT "Building ${name}"
84 )
85 list(APPEND ALL_MANS ${dest})
86 endif (GENERATE_DOC)
87
88 # We should always have an already-compiled copy of each man page in the
89 # source tree, which we can install even if we didn't build fresh new
90 # copies.
91 install(
92 FILES ${dest}
93 DESTINATION "share/man/man${section}"
3894 )
39 endif (LIB_SPHINX_DIR)
40 endmacro(find_prereq_doc)
95 endmacro(pandocify)
4196
42 if (GENERATE_DOC)
43 set(SPHINX_SRC_CONF_FILE "${CMAKE_CURRENT_SOURCE_DIR}/conf.py")
44 set(SPHINX_CONF_FILE "${CMAKE_CURRENT_BINARY_DIR}/conf.py")
45 set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
46 set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
97 foreach(MAN_PAGE ${MAN_PAGES})
98 pandocify(${MAN_PAGE})
99 endforeach(MAN_PAGE)
47100
48 find_prereq_doc(libcork)
49
50 set(
51 VERSION_FOR_CONF_PY
52 "\nrelease=\"${VERSION}\"\nversion=\"${BASE_VERSION}\""
53 )
54 configure_file(${SPHINX_SRC_CONF_FILE} ${SPHINX_CONF_FILE} @ONLY)
55 file(COPY _static DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
56 file(COPY _templates DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
57
58 add_custom_target(doc ALL
59 ${SPHINX_EXECUTABLE}
60 -b html
61 -d "${SPHINX_CACHE_DIR}"
62 -c "${CMAKE_CURRENT_BINARY_DIR}"
63 "${CMAKE_CURRENT_SOURCE_DIR}"
64 "${SPHINX_HTML_DIR}"
65 COMMENT "Building HTML documentation with Sphinx"
66 )
67
68 list(APPEND CLEAN_FILES "${SPHINX_CACHE_DIR}" "${SPHINX_HTML_DIR}")
69 set_directory_properties(
70 PROPERTIES
71 ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_FILES}"
72 )
73
74 install(
75 DIRECTORY "${SPHINX_HTML_DIR}"
76 DESTINATION "share/doc/${PROJECT_NAME}"
77 )
78 endif (GENERATE_DOC)
101 add_custom_target(doc ALL DEPENDS ${ALL_MANS})
+0
-0
docs/_static/.keep less more
(Empty file)
+0
-297
docs/_static/docco-sphinx.css less more
0 @import url("basic.css");
1
2 /* -- page layout ----------------------------------------------------------- */
3
4 body {
5 font-family: 'Palatino Linotype', Palatino, 'URW Palladio L', 'Book Antiqua', FreeSerif, serif;
6 /*font-size: 95%;*/
7 font-size: 95%;
8 color: #252519;
9 margin: 0;
10 padding: 0;
11 }
12
13 div.document {
14 }
15
16 div.documentwrapper {
17 float: left;
18 width: 100%;
19 }
20
21 div.bodywrapper {
22 margin: 0 0 0 19em;
23 background-color: #ffffff;
24 }
25
26 div.body {
27 color: #252519;
28 padding: 30px 0px 30px 60px;
29 width: 40em;
30 }
31
32 div.footer {
33 width: 100%;
34 padding: 9px 0 9px 0;
35 text-align: center;
36 font-size: 75%;
37 }
38
39 div.footer a {
40 color: #261a3b;
41 text-decoration: underline;
42 }
43
44 div.related {
45 background-color: #eee;
46 border: 1px solid #ccc;
47 line-height: 30px;
48 }
49
50 div.related a {
51 color: #261a3b;
52 }
53
54 div.sphinxsidebar {
55 padding: 30px 0px 0 20px;
56 width: 19em;
57 color: #555;
58 }
59
60 div.sphinxsidebar a {
61 color: #555;
62 }
63
64 div.sphinxsidebar h3 {
65 font-size: 1.4em;
66 margin: 0;
67 padding: 0;
68 }
69
70 div.sphinxsidebar h4 {
71 font-size: 1.3em;
72 margin: 5px 0 0 0;
73 padding: 0;
74 }
75
76 div.sphinxsidebar p {
77 }
78
79 div.sphinxsidebar p.topless {
80 margin: 5px 10px 10px 10px;
81 }
82
83 div.sphinxsidebar ul {
84 margin: 10px;
85 padding: 0;
86 color: #ffffff;
87 }
88
89 div.sphinxsidebar li {
90 padding-top: 5px;
91 line-height: 115%;
92 }
93
94 div.sphinxsidebar input {
95 border: 1px solid #ccc;
96 font-family: sans-serif;
97 font-size: 1em;
98 }
99
100
101
102 /* -- hyperlink styles ------------------------------------------------------ */
103
104 a {
105 color: #306060;
106 text-decoration: none;
107 }
108
109 a:visited {
110 color: #306060;
111 text-decoration: none;
112 }
113
114 a:hover {
115 text-decoration: underline;
116 }
117
118
119
120 /* -- body styles ----------------------------------------------------------- */
121
122 div.body h1,
123 div.body h2,
124 div.body h3,
125 div.body h4,
126 div.body h5,
127 div.body h6 {
128 border-top: 1px solid #ccc;
129 margin: 40px -20px 10px -20px;
130 padding: 3px 0 3px 0;
131 }
132
133 div.body h1 { margin-top: 0; font-size: 200%; border: 0px; }
134 div.body h2 { font-size: 160%; }
135 div.body h3 { font-size: 140%; }
136 div.body h4 { font-size: 120%; }
137 div.body h5 { font-size: 110%; }
138 div.body h6 { font-size: 100%; }
139
140 a.headerlink {
141 color: #c60f0f;
142 font-size: 0.8em;
143 padding: 0 4px 0 4px;
144 text-decoration: none;
145 }
146
147 a.headerlink:hover {
148 background-color: #c60f0f;
149 color: white;
150 }
151
152 div.body p, div.body dd, div.body li {
153 line-height: 130%;
154 }
155
156 p.admonition-title {
157 margin-right: 0.3em;
158 }
159
160 div.admonition p.admonition-title + p {
161 display: inline;
162 }
163
164 div.admonition p {
165 margin-bottom: 5px;
166 }
167
168 div.admonition pre {
169 margin-bottom: 5px;
170 }
171
172 div.admonition ul, div.admonition ol {
173 margin-bottom: 5px;
174 }
175
176 div.note {
177 background-color: #eee;
178 border: 1px solid #ccc;
179 }
180
181 div.seealso {
182 background-color: #ffc;
183 border: 1px solid #ff6;
184 }
185
186 div.topic {
187 background-color: #eee;
188 }
189
190 div.warning {
191 background-color: #ffe4e4;
192 border: 1px solid #f66;
193 }
194
195 p.admonition-title {
196 display: inline;
197 }
198
199 p.admonition-title:after {
200 content: ":";
201 }
202
203 pre {
204 font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace;
205 font-size: 80%;
206 padding: 5px;
207 background-color: #f5f5ff;
208 color: #333333;
209 line-height: 130%;
210 border: 1px solid #e5e5ee;
211 border-left: none;
212 border-right: none;
213 }
214
215 tt {
216 font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace;
217 background-color: #f8f8ff;
218 border: 1px solid #dedede;
219 padding: 0 0.2em;
220 font-size: 85%;
221 }
222
223 a tt {
224 background-color: transparent;
225 border: 0px;
226 }
227
228 dt {
229 font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace;
230 font-size: 90%;
231 line-height: 130%;
232 }
233
234 table.indextable dt {
235 font-family: 'Palatino Linotype', Palatino, 'URW Palladio L', 'Book Antiqua', FreeSerif, serif;
236 font-size: 100%;
237 }
238
239 em.property {
240 font-size: 90%;
241 }
242
243 tt.descclassname {
244 background-color: transparent;
245 border: 0px;
246 padding: 0px;
247 }
248
249 tt.descname {
250 background-color: transparent;
251 border: 0px;
252 font-size: 100%;
253 padding: 0px;
254 }
255
256 dt big {
257 font-family: 'Palatino Linotype', Palatino, 'URW Palladio L', 'Book Antiqua', FreeSerif, serif;
258 font-size: 140%;
259 padding: 0 2px;
260 }
261
262 dt big.param_start_brace {
263 padding: 0 6px;
264 }
265
266 dt big.param_end_brace {
267 padding: 0 6px;
268 }
269
270 dt span.optional {
271 font-family: 'Palatino Linotype', Palatino, 'URW Palladio L', 'Book Antiqua', FreeSerif, serif;
272 font-size: 140%;
273 padding: 0 2px;
274 }
275
276 th {
277 background-color: #ede;
278 }
279
280 .warning tt {
281 background: #efc2c2;
282 }
283
284 .note tt {
285 background: #d6d6d6;
286 }
287
288 .viewcode-back {
289 font-family: sans-serif;
290 }
291
292 div.viewcode-block:target {
293 background-color: #f4debf;
294 border-top: 1px solid #ac9;
295 border-bottom: 1px solid #ac9;
296 }
+0
-61
docs/_static/pygments.css less more
0 .highlight .hll { background-color: #ffffcc }
1 .highlight .c { color: #408080; font-style: italic } /* Comment */
2 .highlight .err { border: 1px solid #FF0000 } /* Error */
3 .highlight .k { color: #954121 } /* Keyword */
4 .highlight .o { color: #666666 } /* Operator */
5 .highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
6 .highlight .cp { color: #BC7A00 } /* Comment.Preproc */
7 .highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
8 .highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
9 .highlight .gd { color: #A00000 } /* Generic.Deleted */
10 .highlight .ge { font-style: italic } /* Generic.Emph */
11 .highlight .gr { color: #FF0000 } /* Generic.Error */
12 .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
13 .highlight .gi { color: #00A000 } /* Generic.Inserted */
14 .highlight .go { color: #808080 } /* Generic.Output */
15 .highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
16 .highlight .gs { font-weight: bold } /* Generic.Strong */
17 .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
18 .highlight .gt { color: #0040D0 } /* Generic.Traceback */
19 .highlight .kc { color: #954121 } /* Keyword.Constant */
20 .highlight .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
21 .highlight .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
22 .highlight .kp { color: #954121 } /* Keyword.Pseudo */
23 .highlight .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
24 .highlight .kt { color: #B00040 } /* Keyword.Type */
25 .highlight .m { color: #666666 } /* Literal.Number */
26 .highlight .s { color: #219161 } /* Literal.String */
27 .highlight .na { color: #7D9029 } /* Name.Attribute */
28 .highlight .nb { color: #954121 } /* Name.Builtin */
29 .highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
30 .highlight .no { color: #880000 } /* Name.Constant */
31 .highlight .nd { color: #AA22FF } /* Name.Decorator */
32 .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
33 .highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
34 .highlight .nf { color: #0000FF } /* Name.Function */
35 .highlight .nl { color: #A0A000 } /* Name.Label */
36 .highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
37 .highlight .nt { color: #954121; font-weight: bold } /* Name.Tag */
38 .highlight .nv { color: #19469D } /* Name.Variable */
39 .highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
40 .highlight .w { color: #bbbbbb } /* Text.Whitespace */
41 .highlight .mf { color: #666666 } /* Literal.Number.Float */
42 .highlight .mh { color: #666666 } /* Literal.Number.Hex */
43 .highlight .mi { color: #666666 } /* Literal.Number.Integer */
44 .highlight .mo { color: #666666 } /* Literal.Number.Oct */
45 .highlight .sb { color: #219161 } /* Literal.String.Backtick */
46 .highlight .sc { color: #219161 } /* Literal.String.Char */
47 .highlight .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
48 .highlight .s2 { color: #219161 } /* Literal.String.Double */
49 .highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
50 .highlight .sh { color: #219161 } /* Literal.String.Heredoc */
51 .highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
52 .highlight .sx { color: #954121 } /* Literal.String.Other */
53 .highlight .sr { color: #BB6688 } /* Literal.String.Regex */
54 .highlight .s1 { color: #219161 } /* Literal.String.Single */
55 .highlight .ss { color: #19469D } /* Literal.String.Symbol */
56 .highlight .bp { color: #954121 } /* Name.Builtin.Pseudo */
57 .highlight .vc { color: #19469D } /* Name.Variable.Class */
58 .highlight .vg { color: #19469D } /* Name.Variable.Global */
59 .highlight .vi { color: #19469D } /* Name.Variable.Instance */
60 .highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
+0
-0
docs/_templates/.keep less more
(Empty file)
+0
-77
docs/conf.py less more
0 # -*- coding: utf-8 -*-
1
2 import sys, os
3
4 extensions = ['sphinx.ext.intersphinx']
5 source_suffix = '.rst'
6 master_doc = 'index'
7 project_name = u'IP set'
8 project_slug = u'ipset'
9 company = u'RedJack, LLC'
10 copyright_years = u'2009-2012'
11
12 default_role = 'c:func'
13 primary_domain = 'c'
14
15 rst_epilog = """
16 .. |project_name| replace:: """ + project_name + """
17 """
18
19 # Intersphinx stuff
20
21 intersphinx_mapping = {
22 'libcork': ('http://libcork.readthedocs.org/en/latest/', None),
23 }
24
25 # Our CMake build scripts will insert overrides below if the prereq
26 # libraries have installed their Sphinx documentation locally. DO NOT
27 # uncomment out the last line of this block; we need it commented so
28 # that this conf.py file still works if CMake doesn't do its
29 # substitution thing.
30 # @INTERSPHINX_OVERRIDES@
31
32 #----------------------------------------------------------------------
33 # Everything below here shouldn't need to be changed.
34
35 release = None
36 version = None
37
38 # Give CMake a chance to insert a version number
39 # @VERSION_FOR_CONF_PY@
40
41 # Otherwise grab version from git
42 if version is None:
43 import re
44 import subprocess
45 release = subprocess.check_output(["git", "describe"]).rstrip()
46 version = re.sub(r"-dev.*$", "-dev", release)
47
48 # Project details
49
50 project = project_name
51 copyright = copyright_years+u', '+company
52 templates_path = ['_templates']
53 exclude_patterns = ['_build']
54 pygments_style = 'sphinx'
55
56 html_theme = 'default'
57 html_style = 'docco-sphinx.css'
58 html_static_path = ['_static']
59 htmlhelp_basename = project_slug+'-doc'
60
61
62 latex_documents = [
63 ('index', project_slug+'.tex', project_name+u' Documentation',
64 company, 'manual'),
65 ]
66
67 man_pages = [
68 ('index', project_slug, project_name+u' Documentation',
69 [company], 1)
70 ]
71
72 texinfo_documents = [
73 ('index', project_slug, project_name+u' Documentation',
74 company, project_name, 'One line description of project.',
75 'Miscellaneous'),
76 ]
+0
-26
docs/index.rst less more
0 .. _index:
1
2 |project_name| documentation
3 ============================
4
5 This is the documentation for |project_name| |release|, last updated
6 |today|.
7
8
9 Contents
10 --------
11
12 .. toctree::
13 :maxdepth: 2
14
15 sets
16 maps
17 commands
18 file-format
19
20
21 Indices and tables
22 ------------------
23
24 * :ref:`genindex`
25 * :ref:`search`
0 #!/bin/bash
0 #!/bin/sh
11 # Usage: run.sh [debug|release] program arguments
22 #
33 # Runs a program from one of the build directories, with
0 # -*- coding: utf-8 -*-
1 # ----------------------------------------------------------------------
2 # Copyright © 2012, RedJack, LLC.
3 # All rights reserved.
4 #
5 # Please see the LICENSE.txt file in this distribution for license
6 # details.
7 # ----------------------------------------------------------------------
8
9 install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/valgrind
10 DESTINATION share
11 FILES_MATCHING PATTERN "*.supp")
00 # -*- coding: utf-8 -*-
11 # ----------------------------------------------------------------------
2 # Copyright © 2011, RedJack, LLC.
2 # Copyright © 2011-2013, RedJack, LLC.
33 # All rights reserved.
44 #
55 # Please see the LICENSE.txt file in this distribution for license
66 # details.
77 # ----------------------------------------------------------------------
88
9 include_directories(../include)
9 include_directories(${CMAKE_SOURCE_DIR}/include)
10 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
1011
1112 #-----------------------------------------------------------------------
1213 # Build the library
1314
14 file(GLOB_RECURSE LIBIPSET_SRC libipset/*.c)
15 set(LIBIPSET_SRC
16 libipset/general.c
17 libipset/bdd/assignments.c
18 libipset/bdd/basics.c
19 libipset/bdd/bdd-iterator.c
20 libipset/bdd/expanded.c
21 libipset/bdd/reachable.c
22 libipset/bdd/read.c
23 libipset/bdd/write.c
24 libipset/map/allocation.c
25 libipset/map/inspection.c
26 libipset/map/ipv4_map.c
27 libipset/map/ipv6_map.c
28 libipset/map/storage.c
29 libipset/set/allocation.c
30 libipset/set/inspection.c
31 libipset/set/ipv4_set.c
32 libipset/set/ipv6_set.c
33 libipset/set/iterator.c
34 libipset/set/storage.c
35 )
36
37 # Update the VERSION and SOVERSION properties below according to the following
38 # rules (taken from [1]):
39 #
40 # VERSION = current.revision.age
41 #
42 # 1. Start with a VERSION of `0.0.0` for each shared library.
43 # 2. Update VERSION only immediately before a public release of your software.
44 # More frequent updates are unnecessary, and only guarantee that the
45 # current interface number gets larger faster.
46 # 3. If the library source code has changed at all since the last update, then
47 # increment `revision` (`c.r.a` becomes `c.r+1.a`).
48 # 4. If any interfaces have been added, removed, or changed since the last
49 # update, increment `current`, and set `revision` to 0.
50 # 5. If any interfaces have been added since the last public release, then
51 # increment `age`.
52 # 6. If any interfaces have been removed or changed since the last public
53 # release, then set `age` to 0.
54 #
55 # SOVERSION should always equal `current`.
56 #
57 # Note that changing `current` means that you are releasing a new
58 # backwards-incompatible version of the library. This has implications on
59 # packaging, so once an API has stabilized, these should be a rare occurrence.
60 #
61 # [1] http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
1562
1663 add_library(libipset SHARED ${LIBIPSET_SRC})
1764 set_target_properties(libipset PROPERTIES
18 COMPILE_DEFINITIONS G_LOG_DOMAIN="ipset"
1965 OUTPUT_NAME ipset
20 SOVERSION 1.1.0)
21 target_link_libraries(libipset ${CORK_LIBRARIES})
66 VERSION 0.0.0
67 SOVERSION 0)
68 target_link_libraries(libipset
69 ${CORK_LIBRARIES}
70 )
2271
23 install(TARGETS libipset DESTINATION lib)
72 install(TARGETS libipset DESTINATION ${CMAKE_INSTALL_LIBDIR})
2473
2574 #-----------------------------------------------------------------------
2675 # Utility commands
2776
28 file(GLOB_RECURSE IPSETBUILD_SRC ipsetbuild/*.c)
77 set(IPSETBUILD_SRC
78 ipsetbuild/ipsetbuild.c
79 )
80
2981 add_executable(ipsetbuild ${IPSETBUILD_SRC})
3082 target_link_libraries(ipsetbuild libipset)
3183 install(TARGETS ipsetbuild DESTINATION bin)
3284
33 file(GLOB_RECURSE IPSETCAT_SRC ipsetcat/*.c)
85 set(IPSETCAT_SRC
86 ipsetcat/ipsetcat.c
87 )
88
3489 add_executable(ipsetcat ${IPSETCAT_SRC})
3590 target_link_libraries(ipsetcat libipset)
3691 install(TARGETS ipsetcat DESTINATION bin)
3792
38 file(GLOB_RECURSE IPSETDOT_SRC ipsetdot/*.c)
39 add_executable(ipsetdot ${IPSETDOT_SRC})
93 set(IPSETDOT_SRC
94 ipsetdot/ipsetdot.c
95 )
96
97 add_executable(ipsetdot ${IPSETBUILD_SRC})
4098 target_link_libraries(ipsetdot libipset)
4199 install(TARGETS ipsetdot DESTINATION bin)
42100
44102 # Generate the pkg-config file
45103
46104 set(prefix ${CMAKE_INSTALL_PREFIX})
47 configure_file(ipset.pc.in ipset.pc)
105 configure_file(ipset.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ipset.pc @ONLY)
48106 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ipset.pc
49 DESTINATION lib/pkgconfig)
107 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
0 *.t -whitespace
2424 macro(make_test test_name)
2525 add_executable(${test_name} ${test_name}.c)
2626 target_link_libraries(${test_name} ${CHECK_LIBRARIES} libipset)
27 add_test(NAME ${test_name} COMMAND ${test_name})
27 add_test(${test_name} ${test_name})
2828 endmacro(make_test)
2929
3030 # Add calls to make_test for each .c test case in the tests/ directory.
3737 #-----------------------------------------------------------------------
3838 # Command-line tests
3939
40 # This will automatically find any test cases in tests/ that should be
41 # run using the run-script helper script. This lets you pass in
42 # arbitary command-line options and stdin to a compiled executable, and
43 # verify its stdout and stderr. The expectation is that your
44 # directories will be named tests/${category}/${test_name}
40 if(TILERA)
41 configure_file(tile-test ${CMAKE_BINARY_DIR}/tile-test COPYONLY)
42 endif(TILERA)
4543
46 configure_file(run-test ${CMAKE_BINARY_DIR}/run-test COPYONLY)
47 configure_file(train ${CMAKE_BINARY_DIR}/train COPYONLY)
44 find_program(
45 CRAM_EXECUTABLE
46 NAMES cram
47 HINTS ENV CRAM_DIR
48 PATH_SUFFIXES bin
49 DOC "Cram test harness"
50 )
4851
49 file(GLOB_RECURSE OUTPUT_TESTS command)
50 foreach(OUTPUT_TEST ${OUTPUT_TESTS})
51 get_filename_component(test_dir ${OUTPUT_TEST} PATH)
52 get_filename_component(test_suffix ${test_dir} NAME)
53 get_filename_component(test_parent_dir ${test_dir} PATH)
54 get_filename_component(test_prefix ${test_parent_dir} NAME)
55 set(test_name "${test_prefix}:${test_suffix}")
56
57 add_test(NAME ${test_name}
58 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
59 COMMAND ${CMAKE_BINARY_DIR}/run-test ${test_dir})
60 endforeach(OUTPUT_TEST ${OUTPUT_TESTS})
52 if (CRAM_EXECUTABLE)
53 configure_file(ccram ${CMAKE_BINARY_DIR}/ccram COPYONLY)
54 add_test(
55 cram-tests
56 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}
57 ${CMAKE_BINARY_DIR}/ccram
58 --cram ${CRAM_EXECUTABLE}
59 --tests ${CMAKE_CURRENT_SOURCE_DIR}
60 )
61 else (CRAM_EXECUTABLE)
62 message(WARNING "Unable to find cram test harness; skipping tests.")
63 endif (CRAM_EXECUTABLE)
0 #!/bin/sh
1
2 if [ "$1" = "--cram" ]; then
3 shift
4 CRAM="$1"
5 shift
6 else
7 CRAM=cram
8 fi
9
10 if [ "$1" = "--tests" ]; then
11 shift
12 TESTS="$1"
13 shift
14 else
15 TESTS=../tests
16 fi
17
18 PATH="$PWD/src:$PATH" \
19 "$CRAM" "$@" "$TESTS"
+0
-55
tests/run-test less more
0 #!/bin/sh
1
2 # Usage: run-test [spec-dir]
3 #
4 # spec-dir should contain the following files:
5 # command the command to run (from within the tests build directory)
6 # in content that will passed to stdin
7 # out content that should appear on stdout
8 # err content that should appear on stderr
9
10 if [ $# -ne 1 ]; then
11 echo "Usage: run-test [spec-dir]" >&2
12 exit 1
13 fi
14
15 SPEC_DIR="$1" && shift
16 if [ ! -d "${SPEC_DIR}" ]; then
17 echo "Spec directory ${SPEC_DIR} doesn't exist"
18 exit 1
19 fi
20
21 if [ ! -f "${SPEC_DIR}"/command ]; then
22 echo "No command in ${SPEC_DIR}"
23 exit 1
24 fi
25
26 TEST_NAME=`basename ${SPEC_DIR}`
27 COMMAND=`cat "${SPEC_DIR}/command"`
28
29 if [ -f "${SPEC_DIR}"/in ]; then
30 IN_FILE="${SPEC_DIR}/in"
31 else
32 IN_FILE=/dev/null
33 fi
34
35 mkdir -p results
36 sh -c "${COMMAND}" < ${IN_FILE} \
37 > results/${TEST_NAME}.out 2> results/${TEST_NAME}.err
38
39 GOOD=1
40
41 if [ -f "${SPEC_DIR}"/out ]; then
42 echo "Comparing stdout..."
43 diff -u "${SPEC_DIR}"/out results/${TEST_NAME}.out || GOOD=0
44 fi
45
46 if [ -f "${SPEC_DIR}"/err ]; then
47 echo "Comparing stderr..."
48 diff -u "${SPEC_DIR}"/err results/${TEST_NAME}.err || GOOD=0
49 fi
50
51 if [ ${GOOD} = 0 ]; then
52 echo "Test failed"
53 exit 1
54 fi
0 #!/usr/bin/env bash
1
2 if [ ! -x $TILERA_ROOT/bin/tile-monitor ]; then
3 # If no tile-monitor is installed, then there is nothing to test.
4 echo "No tile-monitor installed in $TILERA_ROOT/bin"
5 exit 1
6 fi
7
8 export TEST_DIR="/tmp/test"
9 export TILERA_COMMON_ARGS=" \
10 --debug-on-crash \
11 --mkdir $TEST_DIR/build \
12 --mkdir $TEST_DIR/tests \
13 --tile standard \
14 --mount-tile /usr \
15 --mount-tile /lib \
16 --upload . $TEST_DIR/build \
17 --upload ../tests $TEST_DIR/tests \
18 --env LD_LIBRARY_PATH="$TEST_DIR/build/src:/usr/local/lib:/usr/lib:/lib" \
19 --env PATH="/usr/local/bin:$PATH" \
20 --cd $TEST_DIR/build \
21 --run -+- ctest -+- --quit"
22
23 # Note: we assume the Tilera processor is connected to the MDE by an IP
24 # connection and has a hostname of 'tilera'. Trust us - you don't want
25 # to run tests over the serial connection.
26 export TILERA_DEV_ARGS="$TILERA_COMMON_ARGS --net tilera --resume"
27 $TILERA_ROOT/bin/tile-monitor $TILERA_DEV_ARGS
28
29 ## Uncomment the following four lines and comment the previous two if
30 ## you want to run the tests on the Tilera simulator.
31 #export SIM_IMAGE_SIZE="4x4"
32 #export TILERA_SIM_ARGS=" \
33 # --image $SIM_IMAGE_SIZE $TILERA_COMMON_ARGS --functional"
34 #$TILERA_ROOT/bin/tile-monitor $TILERA_SIM_ARGS
+0
-48
tests/train less more
0 #!/bin/sh
1
2 # Usage: train [spec-dir]
3 #
4 # spec-dir should contain the following files:
5 # command the command to run (from within the top-level build directory)
6 # in content that will passed to stdin
7
8 if [ $# -ne 1 ]; then
9 echo "Usage: run-test [spec-dir]" >&2
10 exit 1
11 fi
12
13 SPEC_DIR="$1" && shift
14 if [ ! -d "${SPEC_DIR}" ]; then
15 echo "Spec directory ${SPEC_DIR} doesn't exist"
16 exit 1
17 fi
18
19 if [ ! -f "${SPEC_DIR}"/command ]; then
20 echo "No command in ${SPEC_DIR}"
21 exit 1
22 fi
23
24 TEST_NAME=`basename ${SPEC_DIR}`
25 COMMAND=`cat "${SPEC_DIR}/command"`
26
27 if [ -f "${SPEC_DIR}"/in ]; then
28 IN_FILE="${SPEC_DIR}/in"
29 else
30 IN_FILE=/dev/null
31 fi
32
33 echo "Saving ${TEST_NAME} stdout and stderr..."
34
35 sh -c "${COMMAND}" < ${IN_FILE} \
36 > "${SPEC_DIR}/out" 2> "${SPEC_DIR}/err"
37
38 echo ""
39 echo "Is this what you expected?"
40
41 echo ""
42 echo "stdout:"
43 cat "${SPEC_DIR}/out"
44
45 echo ""
46 echo "stderr:"
47 cat "${SPEC_DIR}/err"
0 #!/bin/bash
0 #!/bin/sh
11 # ----------------------------------------------------------------------
2 # Copyright © 2011, RedJack, LLC.
2 # Copyright © 2011-2013, RedJack, LLC.
33 # All rights reserved.
44 #
55 # Please see the LICENSE.txt file in this distribution for license