Skip to content

Commit 3a73f8a

Browse files
authored
Merge branch 'master' into general_ci_ipv
2 parents 39fc55d + 908313d commit 3a73f8a

File tree

5 files changed

+44
-7
lines changed

5 files changed

+44
-7
lines changed

.github/workflows/lint_and_test_cpp.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ jobs:
324324
steps:
325325
- uses: actions/checkout@v3
326326
- uses: "./.github/actions/rebuild_thirdparty_if_needed"
327+
# TODO(yingchun): Append "-m dsn_utils_tests" to the command if not needed to pack server or tools, for example, the dependencies are static linked.
327328
- uses: "./.github/actions/build_pegasus"
328329
- uses: "./.github/actions/upload_artifact"
329330

run.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function usage_build()
8181
{
8282
echo "Options for subcommand 'build':"
8383
echo " -h|--help print the help info"
84+
echo " -m|--modules specify modules to build, split by ',',"
85+
echo " e.g., \"pegasus_unit_test,dsn_runtime_tests,dsn_meta_state_tests\","
86+
echo " if not set, then build all objects"
8487
echo " -t|--type build type: debug|release, default is release"
8588
echo " -c|--clear clear pegasus before building, not clear thirdparty"
8689
echo " --clear_thirdparty clear thirdparty/pegasus before building"
@@ -128,13 +131,18 @@ function run_build()
128131
USE_JEMALLOC=OFF
129132
BUILD_TEST=OFF
130133
IWYU=""
134+
BUILD_MODULES=""
131135
while [[ $# > 0 ]]; do
132136
key="$1"
133137
case $key in
134138
-h|--help)
135139
usage_build
136140
exit 0
137141
;;
142+
-m|--modules)
143+
BUILD_MODULES=$2
144+
shift
145+
;;
138146
-t|--type)
139147
BUILD_TYPE="$2"
140148
shift
@@ -213,6 +221,12 @@ function run_build()
213221
exit 1
214222
fi
215223

224+
# Replace all ',' to ' ' in $BUILD_MODULES.
225+
if [ "$BUILD_MODULES" != "" ]; then
226+
BUILD_MODULES=${BUILD_MODULES//,/ }
227+
fi
228+
echo "build_modules=$BUILD_MODULES"
229+
216230
CMAKE_OPTIONS="-DCMAKE_C_COMPILER=${C_COMPILER}
217231
-DCMAKE_CXX_COMPILER=${CXX_COMPILER}
218232
-DUSE_JEMALLOC=${USE_JEMALLOC}"
@@ -325,6 +339,8 @@ function run_build()
325339
pushd $BUILD_DIR
326340
if [ ! -z "${IWYU}" ]; then
327341
make $MAKE_OPTIONS 2> iwyu.out
342+
elif [ "$BUILD_MODULES" != "" ]; then
343+
make $BUILD_MODULES $MAKE_OPTIONS
328344
else
329345
make install $MAKE_OPTIONS
330346
fi

src/replica/storage/simple_kv/test/simple_kv.server.impl.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,19 @@
3737

3838
#include "aio/aio_task.h"
3939
#include "aio/file_io.h"
40+
#include "common/replication.codes.h"
4041
#include "consensus_types.h"
4142
#include "rocksdb/env.h"
4243
#include "rocksdb/slice.h"
4344
#include "rocksdb/status.h"
4445
#include "runtime/serverlet.h"
45-
#include "runtime/task/task_code.h"
4646
#include "simple_kv_types.h"
4747
#include "utils/autoref_ptr.h"
4848
#include "utils/binary_reader.h"
4949
#include "utils/blob.h"
5050
#include "utils/env.h"
5151
#include "utils/filesystem.h"
5252
#include "utils/fmt_logging.h"
53-
#include "utils/threadpool_code.h"
5453
#include "utils/utils.h"
5554

5655
// TODO(yingchun): most of the code are the same as
@@ -68,8 +67,6 @@ namespace dsn {
6867
namespace replication {
6968
namespace test {
7069

71-
DEFINE_TASK_CODE(LPC_AIO_IMMEDIATE_CALLBACK, TASK_PRIORITY_COMMON, dsn::THREAD_POOL_DEFAULT)
72-
7370
bool simple_kv_service_impl::s_simple_kv_open_fail = false;
7471
bool simple_kv_service_impl::s_simple_kv_close_fail = false;
7572
bool simple_kv_service_impl::s_simple_kv_get_checkpoint_fail = false;

src/utils/simple_logger.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,31 @@ void screen_logger::dsn_logv(const char *file,
138138
vprintf(fmt, args);
139139
printf("\n");
140140

141+
if (log_level >= LOG_LEVEL_ERROR) {
142+
::fflush(stdout);
143+
}
144+
145+
process_fatal_log(log_level);
146+
}
147+
148+
void screen_logger::dsn_log(const char *file,
149+
const char *function,
150+
const int line,
151+
dsn_log_level_t log_level,
152+
const char *str)
153+
{
154+
utils::auto_lock<::dsn::utils::ex_lock_nr> l(_lock);
155+
156+
print_header(stdout, log_level);
157+
if (!_short_header) {
158+
printf("%s:%d:%s(): ", file, line, function);
159+
}
160+
printf("%s\n", str);
161+
162+
if (log_level >= LOG_LEVEL_ERROR) {
163+
::fflush(stdout);
164+
}
165+
141166
process_fatal_log(log_level);
142167
}
143168

src/utils/simple_logger.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ class screen_logger : public logging_provider
5757
const char *function,
5858
const int line,
5959
dsn_log_level_t log_level,
60-
const char *str) override
61-
{
62-
}
60+
const char *str) override;
6361

6462
virtual void flush();
6563

0 commit comments

Comments
 (0)