From 4836843b994784e2a9b04e5b617e0941be7136ae Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Mon, 9 May 2022 17:03:31 +0800 Subject: [PATCH] fix(os): TDinternal CI error. --- include/os/osFile.h | 1 + source/os/src/osFile.c | 10 ++++++++++ tests/script/sh/copy_udf.sh | 2 +- tests/script/tsim/tmq/consume.sh | 6 +----- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/os/osFile.h b/include/os/osFile.h index b364d233ef..5ba161270d 100644 --- a/include/os/osFile.h +++ b/include/os/osFile.h @@ -80,6 +80,7 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count); void taosFprintfFile(TdFilePtr pFile, const char *format, ...); int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict ptrBuf); +int64_t taosGetsFile(TdFilePtr pFile, int32_t maxSize, char *__restrict buf); int32_t taosEOFFile(TdFilePtr pFile); diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index ab68c69b8d..4fd672fe3c 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -688,6 +688,16 @@ int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) { return getline(ptrBuf, &len, pFile->fp); #endif } +int64_t taosGetsFile(TdFilePtr pFile, int32_t maxSize, char *__restrict buf) { + if (pFile == NULL || buf == NULL ) { + return -1; + } + assert(pFile->fp != NULL); + if (fgets(buf, maxSize, pFile->fp) == NULL) { + return -1; + } + return strlen(buf); +} int32_t taosEOFFile(TdFilePtr pFile) { if (pFile == NULL) { return 0; diff --git a/tests/script/sh/copy_udf.sh b/tests/script/sh/copy_udf.sh index e1d9ff53d2..97f8b16363 100755 --- a/tests/script/sh/copy_udf.sh +++ b/tests/script/sh/copy_udf.sh @@ -5,7 +5,7 @@ set +e echo "Executing copy_udf.sh" -SCRIPT_DIR=`dirname $0` +SCRIPT_DIR=`pwd` cd $SCRIPT_DIR/../ IN_TDINTERNAL="community" diff --git a/tests/script/tsim/tmq/consume.sh b/tests/script/tsim/tmq/consume.sh index 28e03d8fb9..3fa71d6edd 100755 --- a/tests/script/tsim/tmq/consume.sh +++ b/tests/script/tsim/tmq/consume.sh @@ -62,11 +62,7 @@ fi TOP_DIR=`pwd` -if [[ "$SCRIPT_DIR" == *"$IN_TDINTERNAL"* ]]; then - BIN_DIR=`find . -name "tmq_sim"|grep bin|head -n1|cut -d '/' -f 2,3` -else - BIN_DIR=`find . -name "tmq_sim"|grep bin|head -n1|cut -d '/' -f 2` -fi +BIN_DIR=`find . -name "tmq_sim"|grep bin|head -n1|cut -d '/' -f 2` declare -x BUILD_DIR=$TOP_DIR/$BIN_DIR