C ares test (#48)
* c-ares to be built with CMake+Ninja, c-ares version test * remove not relevant comment
This commit is contained in:
parent
deffd0d10c
commit
51e2fac3d8
|
@ -4,6 +4,7 @@ test_suite(
|
||||||
"//examples/cmake:test_libgd",
|
"//examples/cmake:test_libgd",
|
||||||
"//examples/cmake:test_libpng",
|
"//examples/cmake:test_libpng",
|
||||||
"//examples/cmake:test_zlib",
|
"//examples/cmake:test_zlib",
|
||||||
|
"//examples/cmake_cares:test_c_ares",
|
||||||
"//examples/ninja:test_ninja_version",
|
"//examples/ninja:test_ninja_version",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,19 @@ cmake_external(
|
||||||
"CARES_SHARED": "no",
|
"CARES_SHARED": "no",
|
||||||
"CARES_STATIC": "on",
|
"CARES_STATIC": "on",
|
||||||
},
|
},
|
||||||
|
cmake_options = ["-GNinja"],
|
||||||
lib_source = "@cares//:all",
|
lib_source = "@cares//:all",
|
||||||
|
make_commands = [
|
||||||
|
"ninja",
|
||||||
|
"ninja install",
|
||||||
|
],
|
||||||
static_libraries = ["libcares.a"],
|
static_libraries = ["libcares.a"],
|
||||||
tools_deps = [":ninjatool"],
|
tools_deps = [":ninjatool"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "test_c_ares",
|
||||||
|
srcs = ["c-ares-test.cpp"],
|
||||||
|
visibility = ["//:__pkg__"],
|
||||||
|
deps = [":cares"],
|
||||||
|
)
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "ares.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
int version = 0;
|
||||||
|
const char* strVersion = ares_version(&version);
|
||||||
|
if (strcmp(strVersion, "1.14.0") != 0) {
|
||||||
|
throw std::runtime_error("Wrong version: " + std::string(strVersion));
|
||||||
|
}
|
||||||
|
std::cout << "C-ares version: " << strVersion;
|
||||||
|
}
|
Loading…
Reference in New Issue