diff options
author | Viktors Tjarve <viktors.tjarve@zabbix.com> | 2018-05-14 11:22:22 +0300 |
---|---|---|
committer | Viktors Tjarve <viktors.tjarve@zabbix.com> | 2018-05-14 11:22:22 +0300 |
commit | 788ae9c3d44b4787f0b7a66a14c7e6ae51f68dbe (patch) | |
tree | e6149548ae655499f7f9e3bf0e72aa4fd10da47a /build-backend.xml | |
parent | 41a0b17a2e686f1270c8b2cb9f70e78d2de14df9 (diff) |
.......... [DEV-812] merged with changes made in DEV-833 to use the new design of 'cmocka-tests' target
[merge ^/trunk -c r80757]
Diffstat (limited to 'build-backend.xml')
-rw-r--r-- | build-backend.xml | 127 |
1 files changed, 72 insertions, 55 deletions
diff --git a/build-backend.xml b/build-backend.xml index a073350b3e9..a3e9b56d355 100644 --- a/build-backend.xml +++ b/build-backend.xml @@ -34,8 +34,8 @@ <property name="conf7" value="--enable-server --enable-agent --enable-proxy ${with.db} --with-jabber --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-libevent --with-gnutls --with-ldap --with-libcurl"/> </target> - <!-- Cppcheck static analysis target --> - <target name="cppcheck-static-analysis"> + <!-- Cppcheck static analyzer target --> + <target name="cppcheck-static-analyzer"> <exec executable="./bootstrap.sh" failonerror="on"></exec> <exec executable="scan-build" failonerror="on"> <arg line="./configure"/> @@ -92,9 +92,6 @@ </for> </target> - <!-- Static analysis container target --> - <target name="static-analysis" depends="cppcheck-static-analysis,clang-static-analyzer"/> - <target name="init"> <!-- Create database schema --> <exec executable="./bootstrap.sh" failonerror="on"></exec> @@ -223,27 +220,6 @@ <target name="create-db" depends="create-db-mysql,create-db-postgresql"/> - <target name="make-gcc" depends="init-conf-options"> - <!-- Build Zabbix with various configuration parameters --> - <propertyselector property="conf.list" delimiter="," match="conf(\d+)"/> - <sortlist property="conf.list" delimiter="," value="${conf.list}" override="true"/> - <for list="${conf.list}" param="name" delimiter=","> - <sequential> - <make args="${@{name}}"/> - </sequential> - </for> - </target> - - <!-- Target "make-gcc" cannot have "init" dependency because it brakes "build-dist" --> - <target name="init-make-gcc" depends="init,make-gcc"/> - - <target name="make-clang"> - <!-- Build Zabbix with clang --> - <sequential> - <make cc="clang" args="--enable-server --enable-agent --enable-proxy ${with.db} --with-jabber --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-libevent --with-openssl --with-ldap --with-libcurl"/> - </sequential> - </target> - <target name="make-db-mysql" unless="${with.mysql}"> <!-- Build Zabbix with postgresql database --> <sequential> @@ -274,36 +250,66 @@ <!-- Build Zabbix with all supported databases --> <target name="make-db" depends="make-db-mysql,make-db-postgresql,make-db-oracle,make-db-db2"/> + + <macrodef name="make-tests"> + <!-- Build Zabbix cmocka tests with the specified command line arguments --> + <attribute name="conf"/> + <attribute name="conf-name"/> + <sequential> + <!-- clean, configure and build --> + <exec executable="./configure" failonerror="on"> + <arg line="@{conf}"/> + </exec> + <trycatch> + <try> + <exec executable="make" failonerror="on"> + <arg line="-s"/> + <arg line="-j5"/> + <arg line="tests_build"/> + </exec> + <mkdir dir="tests_results/@{conf-name}"/> + <exec executable="tests/tests_run.pl" failonerror="on" output="tests_results/@{conf-name}/output.xml"> + <arg line="-x @{conf-name}"/> + </exec> + </try> + <finally> + <exec executable="make" failonerror="on"> + <arg line="-s"/> + <arg line="-j5"/> + <arg line="clean"/> + </exec> + <exec executable="make" failonerror="on"> + <arg line="-s"/> + <arg line="-j5"/> + <arg line="-C"/> + <arg line="tests"/> + <arg line="clean"/> + </exec> + </finally> + </trycatch> + </sequential> + </macrodef> + + <target name="init-cmocka-test-conf-options"> + <!-- Zabbix various configuration parameters for cmocka tests --> + <!-- Configuration option name must consist of prefix 'cmocka-', configuration order number + and configuration title: cmocka-<number>-<title> --> + <property name="cmocka-1-default" value="-q --enable-server --enable-agent --enable-proxy --enable-ipv6 --with-mysql --with-jabber --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-libevent --with-mbedtls --with-ldap --with-libcurl --with-iconv --with-libpcre"/> + <property name="cmocka-2-sanitizer" value="CC=clang CFLAGS='-Wall -Wextra -Wenum-conversion -g -O2 -fsanitize=leak,address' LDFLAGS='-fsanitize=leak,address' -q --enable-server --enable-agent --enable-proxy --enable-ipv6 --with-mysql --with-jabber --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-libevent --with-mbedtls --with-ldap --with-libcurl --with-iconv --with-libpcre"/> + </target> - <target name="mock-tests"> - <!-- Build Zabbix with C mock tests --> + <target name="cmocka-tests" depends="init-cmocka-test-conf-options"> + <!-- Build Zabbix with cmocka tests --> + <delete dir="tests_results"/> + <mkdir dir="tests_results"/> <exec executable="./bootstrap.sh" failonerror="on"></exec> - <exec executable="./configure" failonerror="on"> - <arg line="-q"/> - <arg line="--enable-server"/> - <arg line="--enable-agent"/> - <arg line="--enable-proxy"/> - <arg line="--enable-ipv6"/> - <arg line="--with-mysql"/> - <arg line="--with-jabber"/> - <arg line="--with-libxml2"/> - <arg line="--with-unixodbc"/> - <arg line="--with-net-snmp"/> - <arg line="--with-ssh2"/> - <arg line="--with-openipmi"/> - <arg line="--with-libevent"/> - <arg line="--with-mbedtls"/> - <arg line="--with-ldap"/> - <arg line="--with-libcurl"/> - <arg line="--with-iconv"/> - <arg line="--with-libpcre"/> - </exec> - <exec executable="make" failonerror="on"> - <arg line="-s"/> - <arg line="-j5"/> - <arg line="tests_build"/> - </exec> - <exec executable="tests/tests_run.pl" failonerror="on" output="output.xml"></exec> + <propertyselector property="conf.list" delimiter="," match="cmocka-(.*)" select="\1"/> + <sortlist property="conf.list" delimiter="," value="${conf.list}" override="true"/> + <for list="${conf.list}" param="name" delimiter=","> + <sequential> + <make-tests conf="${cmocka-@{name}}" conf-name="@{name}"/> + </sequential> + </for> </target> <target name="run-unit-test"> @@ -321,6 +327,17 @@ <make args="--enable-server --with-mysql --with-libxml2" target="test" post-action="run-unit-test"/> </target> + <target name="make-gcc" depends="init-conf-options"> + <!-- Build Zabbix with various configuration parameters --> + <propertyselector property="conf.list" delimiter="," match="conf(\d+)"/> + <sortlist property="conf.list" delimiter="," value="${conf.list}" override="true"/> + <for list="${conf.list}" param="name" delimiter=","> + <sequential> + <make args="${@{name}}"/> + </sequential> + </for> + </target> + <target name="build-dist" depends="create-db,make-gcc,make-db"/> <target name="make-dist" depends="init"> @@ -342,5 +359,5 @@ </sequential> </target> - <target name="build" depends="init,make-clang,make-dist"/> + <target name="build" depends="init,make-dist"/> </project> |