mirror of https://github.com/eclipse/paho.mqtt.c
Getting test1 to work
This commit is contained in:
parent
dce08bebd6
commit
22dc82e1bc
|
|
@ -168,7 +168,6 @@
|
|||
<exec executable="./${aTest}" failonerror="true" dir="${output.folder}" >
|
||||
<arg value="--connection" />
|
||||
<arg value="tcp://${test.hostname}:1883" />
|
||||
<arg value="--verbose" />
|
||||
<env key="LD_LIBRARY_PATH" value="." />
|
||||
</exec>
|
||||
</target>
|
||||
|
|
|
|||
238
build.xml~
238
build.xml~
|
|
@ -1,238 +0,0 @@
|
|||
<project name="MQTT C Client" default="full">
|
||||
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
||||
<classpath>
|
||||
<pathelement location="/opt/public/cbi/build/3rdPartyJars/ant-contrib.jar" />
|
||||
<pathelement location="/usr/share/java/ant-contrib.jar" />
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<property name="output.folder" value="build/output" />
|
||||
<property name="release.version" value="1.0.0.2" />
|
||||
|
||||
<property name="libname" value="mqttv3c" />
|
||||
<property name="libname.ssl" value="mqttv3cs" />
|
||||
<property name="libname.async" value="mqttv3a" />
|
||||
<property name="libname.async.ssl" value="mqttv3as" />
|
||||
<property name="ssl" value="yes" />
|
||||
|
||||
<target name="init">
|
||||
<tstamp>
|
||||
<format property="buildTimestamp" pattern="yyyyMMddHHmm" />
|
||||
</tstamp>
|
||||
<property name="test.hostname" value="m2m.eclipse.org"/>
|
||||
|
||||
<fileset id="sync.source.fileset" dir="src">
|
||||
<include name="*.c"/>
|
||||
<exclude name="MQTTAsync.c"/>
|
||||
<exclude name="MQTTVersion.c"/>
|
||||
</fileset>
|
||||
<pathconvert refid="sync.source.fileset" property="sync.source.files" pathsep=" "/>
|
||||
|
||||
<fileset id="async.source.fileset" dir="src">
|
||||
<include name="*.c"/>
|
||||
<exclude name="MQTTClient.c"/>
|
||||
<exclude name="MQTTVersion.c"/>
|
||||
</fileset>
|
||||
<pathconvert refid="async.source.fileset" property="async.source.files" pathsep=" "/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="version" depends="init" description="replace tags in the source with the right levels">
|
||||
<property name="build.level" value="${DSTAMP}${TSTAMP}" />
|
||||
<replace file="src/MQTTClient.c" token="##MQTTCLIENT_BUILD_TAG##" value="${build.level}" />
|
||||
<replace file="src/MQTTClient.c" token="##MQTTCLIENT_VERSION_TAG##" value="${release.version}" />
|
||||
<replace file="src/MQTTAsync.c" token="##MQTTCLIENT_BUILD_TAG##" value="${build.level}" />
|
||||
<replace file="src/MQTTAsync.c" token="##MQTTCLIENT_VERSION_TAG##" value="${release.version}" />
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="version">
|
||||
<if>
|
||||
<os family="unix" />
|
||||
<then>
|
||||
<property name="ccflags.so" value="-fPIC -Os -Wall" />
|
||||
<property name="ldflags.so" value="-fvisibility=hidden -shared" />
|
||||
<mkdir dir="${output.folder}"/>
|
||||
|
||||
<!-- non-SSL, synchronous library -->
|
||||
<property name="output.filename" value="${output.folder}/lib${libname}.so" />
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="${ccflags.so} ${ldflags.so} -Wl,-soname,lib${libname}.so -o ${output.filename} ${sync.source.files}"/>
|
||||
</exec>
|
||||
<exec executable="strip" failonerror="true">
|
||||
<arg value="${output.filename}" />
|
||||
</exec>
|
||||
|
||||
<if>
|
||||
<equals arg1="${ssl}" arg2="yes" />
|
||||
<then>
|
||||
<!-- SSL, synchronous library -->
|
||||
<property name="output.ssl.filename" value="${output.folder}/lib${libname.ssl}.so" />
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="-DOPENSSL ${ccflags.so} ${ldflags.so} -Wl,-soname,lib${libname.ssl}.so -o ${output.ssl.filename} ${sync.source.files}"/>
|
||||
</exec>
|
||||
<exec executable="strip" failonerror="true">
|
||||
<arg value="${output.ssl.filename}" />
|
||||
</exec>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<!-- non-SSL, asynchronous library -->
|
||||
<property name="output.async.filename" value="${output.folder}/lib${libname.async}.so" />
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="${ccflags.so} ${ldflags.so} -Wl,-soname,lib${libname.async}.so -o ${output.async.filename} ${async.source.files}"/>
|
||||
</exec>
|
||||
<exec executable="strip" failonerror="true">
|
||||
<arg value="${output.async.filename}" />
|
||||
</exec>
|
||||
|
||||
<if>
|
||||
<equals arg1="${ssl}" arg2="yes" />
|
||||
<then>
|
||||
<!-- SSL, asynchronous library -->
|
||||
<property name="output.async.ssl.filename" value="${output.folder}/lib${libname.async.ssl}.so" />
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="-DOPENSSL ${ccflags.so} ${ldflags.so} -Wl,-soname,lib${libname.async.ssl}.so -o ${output.async.ssl.filename} ${async.source.files}"/>
|
||||
</exec>
|
||||
<exec executable="strip" failonerror="true">
|
||||
<arg value="${output.async.ssl.filename}" />
|
||||
</exec>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<!-- MQTTVersion -->
|
||||
<property name="output.async.ssl.filename" value="${output.folder}/lib${libname.async.ssl}.so" />
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="-lpthread -ldl -o ${output.folder}/MQTTVersion src/MQTTVersion.c"/>
|
||||
</exec>
|
||||
<exec executable="strip" failonerror="true">
|
||||
<arg value="${output.folder}/MQTTVersion" />
|
||||
</exec>
|
||||
|
||||
<!-- Samples
|
||||
<property name="output.async.ssl.filename" value="${output.folder}/lib${libname.async.ssl}.so" />
|
||||
<foreach list="$">
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="-lpthread -ldl -o ${output.folder}/MQTTVersion src/MQTTVersion.c"/>
|
||||
</exec>
|
||||
<exec executable="strip" failonerror="true">
|
||||
<arg value="${output.folder}/MQTTVersion" />
|
||||
</exec> -->
|
||||
|
||||
<!-- Build tests -->
|
||||
<foreach target="onecompile" param="aFile" list="test1"/>
|
||||
<foreach target="onecompiles" param="aFile" list="test3"/>
|
||||
<foreach target="asynccompile" param="aFile" list="test4"/>
|
||||
<foreach target="asynccompiles" param="aFile" list="test5"/>
|
||||
|
||||
</then>
|
||||
<elseif>
|
||||
<os family="windows" />
|
||||
<then>
|
||||
|
||||
</then>
|
||||
</elseif>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="onecompile" >
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="-I src -lpthread -lmqttv3c -L${output.folder} -o ${output.folder}/${aFile} test/${aFile}.c"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="onecompiles" >
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="-I src -lpthread -lmqttv3cs -lssl -L${output.folder} -o ${output.folder}/${aFile} test/${aFile}.c"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="asynccompile" >
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="-I src -lpthread -lmqttv3a -L${output.folder} -o ${output.folder}/${aFile} test/${aFile}.c"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="asynccompiles" >
|
||||
<exec executable="gcc" failonerror="true">
|
||||
<arg line="-I src -lpthread -lmqttv3as -lssl -L${output.folder} -o ${output.folder}/${aFile} test/${aFile}.c"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="test" >
|
||||
<foreach target="runAtest" param="aTest" list="test1,test4"/>
|
||||
<foreach target="runSSLtest" param="aTest" list="test3"/>
|
||||
</target>
|
||||
|
||||
<target name="runAtest">
|
||||
<exec executable="./${aTest}" failonerror="true" dir="${output.folder}" >
|
||||
<arg value="--connection" />
|
||||
<arg value="tcp://${test.hostname}:1883" />
|
||||
<env key="LD_LIBRARY_PATH" value="." />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="runSSLtest">
|
||||
<exec executable="./${aTest}" failonerror="true" dir="${output.folder}" >
|
||||
<arg value="--hostname" />
|
||||
<arg value="test.hostname" />
|
||||
<env key="LD_LIBRARY_PATH" value="." />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="doc" >
|
||||
<if>
|
||||
<available file="${doxygen}"/>
|
||||
<then>
|
||||
<exec executable="${doxygen}" dir="${mqttclient_src}">
|
||||
<arg value="${source.folder}/mqttv3c/doc/DoxyfileV3ClientAPI"/>
|
||||
</exec>
|
||||
<mkdir dir="${ship.folder}/doc/html"/>
|
||||
<copy todir="${ship.folder}/doc/html">
|
||||
<fileset dir="${mqttclient_src}/MQTTClient/html"/>
|
||||
</copy>
|
||||
<!-- <zip destfile="${output.folder}/doc/MQTTClient.zip">
|
||||
<zipfileset dir="${mqttclient_src}/MQTTClient" />
|
||||
</zip> -->
|
||||
<exec executable="${doxygen}" dir="${mqttclient_src}">
|
||||
<arg value="${source.folder}/mqttv3c/doc/DoxyfileV3AsyncAPI"/>
|
||||
</exec>
|
||||
<mkdir dir="${ship.folder}/doc/html/MQTTAsync"/>
|
||||
<copy todir="${ship.folder}/doc/html/MQTTAsync">
|
||||
<fileset dir="${mqttclient_src}/MQTTAsync"/>
|
||||
</copy>
|
||||
<!-- <zip destfile="${output.folder}/doc/MQTTAsync.zip">
|
||||
<zipfileset dir="${mqttclient_src}/MQTTAsync" prefix="MQTTAsync/"/>
|
||||
</zip> -->
|
||||
<delete dir="${mqttclient_src}/MQTTClient" />
|
||||
<delete dir="${mqttclient_src}/MQTTAsync" />
|
||||
</then>
|
||||
<else>
|
||||
<echo message="doxygen is not available" />
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="copy">
|
||||
<mkdir dir="${ship.folder}/include"/>
|
||||
<echo message="Copying the headers for the c_client from the output tree" />
|
||||
<copy overwrite="true" todir="${ship.folder}/include">
|
||||
<fileset dir="${mqttclient_src}">
|
||||
<include name="MQTTClient.h"/>
|
||||
<include name="MQTTClientPersistence.h"/>
|
||||
<include name="MQTTAsync.h"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<echo message="Copying the source.zip file from the output tree" />
|
||||
<copy overwrite="true" todir="${ship.folder}">
|
||||
<fileset dir="${output.folder}">
|
||||
<include name="source.zip"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- target name="full" depends="init, version, compile, doc, copy" -->
|
||||
<target name="full" depends="init, version, compile, test" />
|
||||
|
||||
</project>
|
||||
|
|
@ -61,7 +61,7 @@ struct Options
|
|||
int test_no;
|
||||
} options =
|
||||
{
|
||||
"m2m.eclipse.org:1883",
|
||||
"tcp://m2m.eclipse.org:1883",
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
|
|
@ -84,7 +84,10 @@ void getopts(int argc, char** argv)
|
|||
else if (strcmp(argv[count], "--connection") == 0)
|
||||
{
|
||||
if (++count < argc)
|
||||
{
|
||||
options.connection = argv[count];
|
||||
printf("\nSetting connection to %s\n", options.connection);
|
||||
}
|
||||
else
|
||||
usage();
|
||||
}
|
||||
|
|
@ -109,8 +112,7 @@ void getopts(int argc, char** argv)
|
|||
else if (strcmp(argv[count], "--verbose") == 0)
|
||||
{
|
||||
options.verbose = 1;
|
||||
//TODO
|
||||
printf("\nSetting verbose on\n");
|
||||
printf("\nSetting verbose on\n");
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue