From 696bb067cbbc6cd979e3f8d04bac5c0a05d0d94c Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Thu, 26 Sep 2024 11:54:18 +0800 Subject: [PATCH 01/12] ci: new c language samples in the documentation are integrated into ci --- CMakeLists.txt | 1 + docs/examples/c/CMakeLists.txt | 101 +++++++++++++++++++++++++++++++++ tests/docs-examples-test/c.sh | 61 ++++++++++++++++++++ tests/parallel_test/cases.task | 1 + 4 files changed, 164 insertions(+) create mode 100644 docs/examples/c/CMakeLists.txt create mode 100644 tests/docs-examples-test/c.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index ac368c29fe..b20943b69a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ add_subdirectory(source) add_subdirectory(tools) add_subdirectory(utils) add_subdirectory(examples/c) +add_subdirectory(docs/examples/c) add_subdirectory(tests) include(${TD_SUPPORT_DIR}/cmake.install) diff --git a/docs/examples/c/CMakeLists.txt b/docs/examples/c/CMakeLists.txt new file mode 100644 index 0000000000..f636084bab --- /dev/null +++ b/docs/examples/c/CMakeLists.txt @@ -0,0 +1,101 @@ +PROJECT(TDengine) + +IF (TD_LINUX) + INCLUDE_DIRECTORIES(. ${TD_SOURCE_DIR}/src/inc ${TD_SOURCE_DIR}/src/client/inc ${TD_SOURCE_DIR}/inc) + AUX_SOURCE_DIRECTORY(. SRC) + + add_executable(docs_connect_example "") + add_executable(docs_create_db_demo "") + add_executable(docs_insert_data_demo "") + add_executable(docs_query_data_demo "") + add_executable(docs_with_reqid_demo "") + add_executable(docs_sml_insert_demo "") + add_executable(docs_stmt_insert_demo "") + add_executable(docs_tmq_demo "") + + target_sources(docs_connect_example + PRIVATE + "connect_example.c" + ) + + target_sources(docs_create_db_demo + PRIVATE + "create_db_demo.c" + ) + + target_sources(docs_insert_data_demo + PRIVATE + "insert_data_demo.c" + ) + + target_sources(docs_query_data_demo + PRIVATE + "query_data_demo.c" + ) + + target_sources(docs_with_reqid_demo + PRIVATE + "with_reqid_demo.c" + ) + + target_sources(docs_sml_insert_demo + PRIVATE + "sml_insert_demo.c" + ) + + target_sources(docs_stmt_insert_demo + PRIVATE + "stmt_insert_demo.c" + ) + + target_sources(docs_tmq_demo + PRIVATE + "tmq_demo.c" + ) + + target_link_libraries(docs_connect_example + taos + ) + + target_link_libraries(docs_create_db_demo + taos + ) + + target_link_libraries(docs_insert_data_demo + taos + ) + + target_link_libraries(docs_query_data_demo + taos + ) + + target_link_libraries(docs_with_reqid_demo + taos + ) + + target_link_libraries(docs_sml_insert_demo + taos + ) + + target_link_libraries(docs_stmt_insert_demo + taos + ) + + target_link_libraries(docs_tmq_demo + taos + pthread + ) + + SET_TARGET_PROPERTIES(docs_connect_example PROPERTIES OUTPUT_NAME docs_connect_example) + SET_TARGET_PROPERTIES(docs_create_db_demo PROPERTIES OUTPUT_NAME docs_create_db_demo) + SET_TARGET_PROPERTIES(docs_insert_data_demo PROPERTIES OUTPUT_NAME docs_insert_data_demo) + SET_TARGET_PROPERTIES(docs_query_data_demo PROPERTIES OUTPUT_NAME docs_query_data_demo) + SET_TARGET_PROPERTIES(docs_with_reqid_demo PROPERTIES OUTPUT_NAME docs_with_reqid_demo) + SET_TARGET_PROPERTIES(docs_sml_insert_demo PROPERTIES OUTPUT_NAME docs_sml_insert_demo) + SET_TARGET_PROPERTIES(docs_stmt_insert_demo PROPERTIES OUTPUT_NAME docs_stmt_insert_demo) + SET_TARGET_PROPERTIES(docs_tmq_demo PROPERTIES OUTPUT_NAME docs_tmq_demo) +ENDIF () +IF (TD_DARWIN) + INCLUDE_DIRECTORIES(. ${TD_SOURCE_DIR}/src/inc ${TD_SOURCE_DIR}/src/client/inc ${TD_SOURCE_DIR}/inc) + AUX_SOURCE_DIRECTORY(. SRC) +ENDIF () diff --git a/tests/docs-examples-test/c.sh b/tests/docs-examples-test/c.sh new file mode 100644 index 0000000000..d3e30b081d --- /dev/null +++ b/tests/docs-examples-test/c.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +pgrep taosd || taosd >> /dev/null 2>&1 & +pgrep taosadapter || taosadapter >> /dev/null 2>&1 & + +GREEN='\033[0;32m' +RED='\033[0;31m' +NC='\033[0m' + + +TEST_PATH="../../debug/build/bin" + +LOG_FILE="docs-c-test-out.log" + +> $LOG_FILE + +TEST_EXES=( + "docs_connect_example" + "docs_create_db_demo" + "docs_insert_data_demo" + "docs_query_data_demo" + "docs_with_reqid_demo" + "docs_sml_insert_demo" + "docs_stmt_insert_demo" + "docs_tmq_demo" +) + +totalCases=0 +totalFailed=0 +totalSuccess=0 + +for TEST_EXE in "${TEST_EXES[@]}"; do + echo "Executing $TEST_EXE..." + $TEST_PATH/$TEST_EXE >> $LOG_FILE 2>&1 + + RESULT=$? + + if [ "$RESULT" -eq 0 ]; then + totalSuccess=$((totalSuccess + 1)) + echo "[$GREEN OK $NC] $TEST_EXE executed successfully." + else + totalFailed=$((totalFailed + 1)) + echo "[$RED FAILED $NC] $TEST_EXE exited with code $RESULT." + fi + + totalCases=$((totalCases + 1)) +done + +tail -n 40 $LOG_FILE + +echo -e "\nTotal number of cases executed: $totalCases" +if [ "$totalSuccess" -gt "0" ]; then + echo -e "\n${GREEN} ### Total $totalSuccess C case(s) succeed! ### ${NC}" +fi + +if [ "$totalFailed" -ne "0" ]; then + echo -e "\n${RED} ### Total $totalFailed C case(s) failed! ### ${NC}" + exit 1 +fi + +echo "All tests completed." \ No newline at end of file diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 40f2fa3ead..5bb6e1872f 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1559,3 +1559,4 @@ ,,n,docs-examples-test,bash jdbc.sh ,,n,docs-examples-test,bash go.sh ,,n,docs-examples-test,bash test_R.sh +,,n,docs-examples-test,bash c.sh From ab1935643c38efcdd13490054499955167bc50b6 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Thu, 26 Sep 2024 13:41:25 +0800 Subject: [PATCH 02/12] ci: new c language samples in the documentation are integrated into ci --- docs/examples/c/create_db_demo.c | 13 ++++++++++++- docs/examples/c/sml_insert_demo.c | 13 ++++++++++++- tests/docs-examples-test/c.sh | 4 ++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/examples/c/create_db_demo.c b/docs/examples/c/create_db_demo.c index 7ae41da65c..7b9191ec16 100644 --- a/docs/examples/c/create_db_demo.c +++ b/docs/examples/c/create_db_demo.c @@ -39,8 +39,19 @@ static int DemoCreateDB() { return -1; } + // drop database if exists + TAOS_RES *result = taos_query(taos, "DROP DATABASE IF EXISTS power"); + code = taos_errno(result); + if (code != 0) { + fprintf(stderr, "Failed to drop database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result)); + taos_close(taos); + taos_cleanup(); + return -1; + } + taos_free_result(result); + // create database - TAOS_RES *result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power"); + result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power"); code = taos_errno(result); if (code != 0) { fprintf(stderr, "Failed to create database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result)); diff --git a/docs/examples/c/sml_insert_demo.c b/docs/examples/c/sml_insert_demo.c index 63870d90b6..ba9f47be67 100644 --- a/docs/examples/c/sml_insert_demo.c +++ b/docs/examples/c/sml_insert_demo.c @@ -38,8 +38,19 @@ static int DemoSmlInsert() { return -1; } + // drop database if exists + TAOS_RES *result = taos_query(taos, "DROP DATABASE IF EXISTS power"); + code = taos_errno(result); + if (code != 0) { + fprintf(stderr, "Failed to drop database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result)); + taos_close(taos); + taos_cleanup(); + return -1; + } + taos_free_result(result); + // create database - TAOS_RES *result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power"); + result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power"); code = taos_errno(result); if (code != 0) { fprintf(stderr, "Failed to create database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result)); diff --git a/tests/docs-examples-test/c.sh b/tests/docs-examples-test/c.sh index d3e30b081d..0713cc53e0 100644 --- a/tests/docs-examples-test/c.sh +++ b/tests/docs-examples-test/c.sh @@ -14,15 +14,15 @@ LOG_FILE="docs-c-test-out.log" > $LOG_FILE -TEST_EXES=( +declare -a TEST_EXES=( "docs_connect_example" "docs_create_db_demo" "docs_insert_data_demo" "docs_query_data_demo" "docs_with_reqid_demo" - "docs_sml_insert_demo" "docs_stmt_insert_demo" "docs_tmq_demo" + "docs_sml_insert_demo" ) totalCases=0 From 7f7534f0c5975321f777b81934ab7baa4f038766 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Thu, 26 Sep 2024 14:51:58 +0800 Subject: [PATCH 03/12] ci: c language samples ci add environmental cleanup label --- docs/examples/c/create_db_demo.c | 13 +------------ docs/examples/c/sml_insert_demo.c | 13 +------------ tests/docs-examples-test/c.sh | 24 +++++++++++++++++++++--- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/docs/examples/c/create_db_demo.c b/docs/examples/c/create_db_demo.c index 7b9191ec16..7ae41da65c 100644 --- a/docs/examples/c/create_db_demo.c +++ b/docs/examples/c/create_db_demo.c @@ -39,19 +39,8 @@ static int DemoCreateDB() { return -1; } - // drop database if exists - TAOS_RES *result = taos_query(taos, "DROP DATABASE IF EXISTS power"); - code = taos_errno(result); - if (code != 0) { - fprintf(stderr, "Failed to drop database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result)); - taos_close(taos); - taos_cleanup(); - return -1; - } - taos_free_result(result); - // create database - result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power"); + TAOS_RES *result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power"); code = taos_errno(result); if (code != 0) { fprintf(stderr, "Failed to create database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result)); diff --git a/docs/examples/c/sml_insert_demo.c b/docs/examples/c/sml_insert_demo.c index ba9f47be67..63870d90b6 100644 --- a/docs/examples/c/sml_insert_demo.c +++ b/docs/examples/c/sml_insert_demo.c @@ -38,19 +38,8 @@ static int DemoSmlInsert() { return -1; } - // drop database if exists - TAOS_RES *result = taos_query(taos, "DROP DATABASE IF EXISTS power"); - code = taos_errno(result); - if (code != 0) { - fprintf(stderr, "Failed to drop database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result)); - taos_close(taos); - taos_cleanup(); - return -1; - } - taos_free_result(result); - // create database - result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power"); + TAOS_RES *result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power"); code = taos_errno(result); if (code != 0) { fprintf(stderr, "Failed to create database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result)); diff --git a/tests/docs-examples-test/c.sh b/tests/docs-examples-test/c.sh index 0713cc53e0..47d524086e 100644 --- a/tests/docs-examples-test/c.sh +++ b/tests/docs-examples-test/c.sh @@ -25,16 +25,34 @@ declare -a TEST_EXES=( "docs_sml_insert_demo" ) +declare -a NEED_CLEAN=( + "true" + "false" + "false" + "false" + "false" + "false" + "false" + "true" +) + totalCases=0 totalFailed=0 totalSuccess=0 -for TEST_EXE in "${TEST_EXES[@]}"; do +for i in "${!TEST_EXES[@]}"; do + TEST_EXE="${TEST_EXES[$i]}" + NEED_CLEAN_FLAG="${NEED_CLEAN[$i]}" + + if [ "$NEED_CLEAN_FLAG" = "true" ]; then + echo "Cleaning database before executing $TEST_EXE..." + taos -s "drop database if exists power" >> $LOG_FILE 2>&1 + fi + echo "Executing $TEST_EXE..." $TEST_PATH/$TEST_EXE >> $LOG_FILE 2>&1 - RESULT=$? - + if [ "$RESULT" -eq 0 ]; then totalSuccess=$((totalSuccess + 1)) echo "[$GREEN OK $NC] $TEST_EXE executed successfully." From c80965919a7b4f3b6674671a86a1ec9e102602da Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Thu, 26 Sep 2024 18:11:53 +0800 Subject: [PATCH 04/12] ci: path compatible with TDengine and TDinternal --- tests/docs-examples-test/c.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/docs-examples-test/c.sh b/tests/docs-examples-test/c.sh index 47d524086e..7480fe7543 100644 --- a/tests/docs-examples-test/c.sh +++ b/tests/docs-examples-test/c.sh @@ -8,6 +8,16 @@ RED='\033[0;31m' NC='\033[0m' +current_path=$(pwd) + +if [[ $current_path == *"TDinternal"* ]]; then + TEST_PATH="../../../debug/build/bin" +else + TEST_PATH="../../debug/build/bin" +fi + +echo "setting TEST_PATH: $TEST_PATH" + TEST_PATH="../../debug/build/bin" LOG_FILE="docs-c-test-out.log" From 463713971382886df83d957adcfb6b34ff9b6352 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Thu, 26 Sep 2024 19:15:20 +0800 Subject: [PATCH 05/12] ci: path compatible with TDengine and TDinternal --- tests/docs-examples-test/c.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/docs-examples-test/c.sh b/tests/docs-examples-test/c.sh index 7480fe7543..6df1e36927 100644 --- a/tests/docs-examples-test/c.sh +++ b/tests/docs-examples-test/c.sh @@ -18,8 +18,6 @@ fi echo "setting TEST_PATH: $TEST_PATH" -TEST_PATH="../../debug/build/bin" - LOG_FILE="docs-c-test-out.log" > $LOG_FILE From aa87fa2d7a60ca59f9e6d5d83c3f4565cc5fbf59 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Fri, 27 Sep 2024 08:40:53 +0800 Subject: [PATCH 06/12] ci: debug path info --- tests/docs-examples-test/c.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/docs-examples-test/c.sh b/tests/docs-examples-test/c.sh index 6df1e36927..0d2e152677 100644 --- a/tests/docs-examples-test/c.sh +++ b/tests/docs-examples-test/c.sh @@ -14,10 +14,21 @@ if [[ $current_path == *"TDinternal"* ]]; then TEST_PATH="../../../debug/build/bin" else TEST_PATH="../../debug/build/bin" -fi +fi echo "setting TEST_PATH: $TEST_PATH" +pwd +ls -l ../ +ls -l ../../ +ls -l ../../../ +ls -l ../../../debug/ +ls -l ../../../debug/build/ +ls -l ../../../debug/build/bin/ +ls -l ../../../debug/build/bin/docs* + + + LOG_FILE="docs-c-test-out.log" > $LOG_FILE From 8d0f10d43d6e067702fc99a13f858af26fad7196 Mon Sep 17 00:00:00 2001 From: haoranchen Date: Fri, 27 Sep 2024 09:19:48 +0800 Subject: [PATCH 07/12] Update cases.task --- tests/parallel_test/cases.task | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 5bb6e1872f..aabfcf8dce 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -2,6 +2,8 @@ #caseID,rerunTimes,Run with Sanitizer,casePath,caseCommand #NA,NA,y or n,script,./test.sh -f tsim/user/basic.sim +,,n,docs-examples-test,bash c.sh + #unit-test ,,n,unit-test,bash test.sh @@ -1559,4 +1561,4 @@ ,,n,docs-examples-test,bash jdbc.sh ,,n,docs-examples-test,bash go.sh ,,n,docs-examples-test,bash test_R.sh -,,n,docs-examples-test,bash c.sh + From 2736607815898988d3ffc53a72fceb0010473918 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Fri, 27 Sep 2024 19:38:13 +0800 Subject: [PATCH 08/12] ci: delete debug info --- tests/docs-examples-test/c.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/docs-examples-test/c.sh b/tests/docs-examples-test/c.sh index 0d2e152677..49776949d5 100644 --- a/tests/docs-examples-test/c.sh +++ b/tests/docs-examples-test/c.sh @@ -18,16 +18,6 @@ fi echo "setting TEST_PATH: $TEST_PATH" -pwd -ls -l ../ -ls -l ../../ -ls -l ../../../ -ls -l ../../../debug/ -ls -l ../../../debug/build/ -ls -l ../../../debug/build/bin/ -ls -l ../../../debug/build/bin/docs* - - LOG_FILE="docs-c-test-out.log" From c860d1e22c56e0f0c74234694cbb7358de550430 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Fri, 27 Sep 2024 19:41:28 +0800 Subject: [PATCH 09/12] ci: delete debug info --- tests/parallel_test/cases.task | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index aabfcf8dce..45eaec42e8 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -2,7 +2,6 @@ #caseID,rerunTimes,Run with Sanitizer,casePath,caseCommand #NA,NA,y or n,script,./test.sh -f tsim/user/basic.sim -,,n,docs-examples-test,bash c.sh #unit-test From 5ff244cabf69bb4d4faea5a1128c50d92dce2946 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Fri, 27 Sep 2024 19:42:15 +0800 Subject: [PATCH 10/12] ci: delete debug info --- tests/parallel_test/cases.task | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 45eaec42e8..f65aba818a 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -2,7 +2,6 @@ #caseID,rerunTimes,Run with Sanitizer,casePath,caseCommand #NA,NA,y or n,script,./test.sh -f tsim/user/basic.sim - #unit-test ,,n,unit-test,bash test.sh From 8627879036fead417e2afa06b94c60ccb915ad2f Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Sun, 29 Sep 2024 13:08:24 +0800 Subject: [PATCH 11/12] docs: the compilation of the c samples in the documentation is separate from the TDengine build --- CMakeLists.txt | 1 - tests/docs-examples-test/c.sh | 40 +++++++++++++++++++--------------- tests/parallel_test/cases.task | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b20943b69a..ac368c29fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,6 @@ add_subdirectory(source) add_subdirectory(tools) add_subdirectory(utils) add_subdirectory(examples/c) -add_subdirectory(docs/examples/c) add_subdirectory(tests) include(${TD_SUPPORT_DIR}/cmake.install) diff --git a/tests/docs-examples-test/c.sh b/tests/docs-examples-test/c.sh index 49776949d5..54e334b22e 100644 --- a/tests/docs-examples-test/c.sh +++ b/tests/docs-examples-test/c.sh @@ -7,31 +7,35 @@ GREEN='\033[0;32m' RED='\033[0;31m' NC='\033[0m' - -current_path=$(pwd) - -if [[ $current_path == *"TDinternal"* ]]; then - TEST_PATH="../../../debug/build/bin" -else - TEST_PATH="../../debug/build/bin" -fi - +TEST_PATH="../../docs/examples/c" echo "setting TEST_PATH: $TEST_PATH" +cd "${TEST_PATH}" || { echo -e "${RED}Failed to change directory to ${TEST_PATH}${NC}"; exit 1; } LOG_FILE="docs-c-test-out.log" > $LOG_FILE +make > "$LOG_FILE" 2>&1 + +if [ $? -eq 0 ]; then + echo -e "${GREEN}Make completed successfully.${NC}" +else + echo -e "${RED}Make failed. Check log file: $LOG_FILE${NC}" + cat "$LOG_FILE" + exit 1 +fi + + declare -a TEST_EXES=( - "docs_connect_example" - "docs_create_db_demo" - "docs_insert_data_demo" - "docs_query_data_demo" - "docs_with_reqid_demo" - "docs_stmt_insert_demo" - "docs_tmq_demo" - "docs_sml_insert_demo" + "connect_example" + "create_db_demo" + "insert_data_demo" + "query_data_demo" + "with_reqid_demo" + "stmt_insert_demo" + "tmq_demo" + "sml_insert_demo" ) declare -a NEED_CLEAN=( @@ -59,7 +63,7 @@ for i in "${!TEST_EXES[@]}"; do fi echo "Executing $TEST_EXE..." - $TEST_PATH/$TEST_EXE >> $LOG_FILE 2>&1 + ./$TEST_EXE >> $LOG_FILE 2>&1 RESULT=$? if [ "$RESULT" -eq 0 ]; then diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index f65aba818a..be8748741c 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1553,10 +1553,10 @@ ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R #docs-examples test +,,n,docs-examples-test,bash c.sh ,,n,docs-examples-test,bash python.sh #,,n,docs-examples-test,bash node.sh ,,n,docs-examples-test,bash csharp.sh ,,n,docs-examples-test,bash jdbc.sh ,,n,docs-examples-test,bash go.sh ,,n,docs-examples-test,bash test_R.sh - From 849b7eabe4965ac14f8314f27043d399e4e7a636 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Sun, 29 Sep 2024 14:42:53 +0800 Subject: [PATCH 12/12] ci: add makefile of c samples --- docs/examples/c/Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/examples/c/Makefile diff --git a/docs/examples/c/Makefile b/docs/examples/c/Makefile new file mode 100644 index 0000000000..9fda575ec6 --- /dev/null +++ b/docs/examples/c/Makefile @@ -0,0 +1,34 @@ +# Makefile for building TDengine examples on TD Linux platform + +INCLUDE_DIRS = + +TARGETS = connect_example \ + create_db_demo \ + insert_data_demo \ + query_data_demo \ + with_reqid_demo \ + sml_insert_demo \ + stmt_insert_demo \ + tmq_demo + +SOURCES = connect_example.c \ + create_db_demo.c \ + insert_data_demo.c \ + query_data_demo.c \ + with_reqid_demo.c \ + sml_insert_demo.c \ + stmt_insert_demo.c \ + tmq_demo.c + +LIBS = -ltaos -lpthread + + +CFLAGS = -g + +all: $(TARGETS) + +$(TARGETS): + $(CC) $(CFLAGS) -o $@ $(wildcard $(@F).c) $(LIBS) + +clean: + rm -f $(TARGETS) \ No newline at end of file