File tree 6 files changed +91
-12
lines changed
6 files changed +91
-12
lines changed Original file line number Diff line number Diff line change
1
+ name : fast_testing
2
+
3
+ on :
4
+ push :
5
+ pull_request :
6
+ workflow_dispatch :
7
+
8
+ jobs :
9
+ linux :
10
+ # We want to run on external PRs, but not on our own internal
11
+ # PRs as they'll be run by the push to the branch.
12
+ #
13
+ # The main trick is described here:
14
+ # https://github.com/Dart-Code/Dart-Code/pull/2375
15
+ if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
16
+
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+ - uses : actions/setup-python@v3
20
+ with :
21
+ python-version : ' 3.10'
22
+
23
+ - name : Clone the module
24
+ uses : actions/checkout@v3
25
+ with :
26
+ submodules : true
27
+
28
+ - name : Start Kafka
29
+
30
+ with :
31
+ kafka version : " latest"
32
+ zookeeper version : " latest"
33
+ kafka port : 9092
34
+ auto create topic : " true"
35
+
36
+ - name : Install Python dependencies
37
+ run : pip3 install -r tests/requirements.txt
38
+
39
+ - name : Build module
40
+ run : |
41
+ export MAKEFLAGS=-j8
42
+ export CC=clang
43
+ export CXX=clang++
44
+ git clone https://github.com/tarantool/tarantool
45
+ cd tarantool
46
+ git checkout 2.10
47
+ export LSAN_OPTIONS=suppressions=${PWD}/asan/lsan.supp
48
+ cmake . -DENABLE_ASAN=ON -DENABLE_DIST=ON
49
+ make -j16
50
+ sudo make install
51
+ cd ..
52
+ tarantoolctl rocks STATIC_BUILD=ON ENABLE_ASAN=ON make
53
+
54
+ - name : Run tarantool application
55
+ run : |
56
+ export TT_LOG=tarantool.log
57
+ export LSAN_OPTIONS=suppressions=${PWD}/tarantool/asan/lsan.supp
58
+ tarantool tests/app.lua > output.log 2>&1 &
59
+
60
+ - name : Run test
61
+ run : KAFKA_HOST=localhost:9092 pytest tests
62
+
63
+ - name : Print Tarantool logs
64
+ if : always()
65
+ run : |
66
+ cat tarantool.log
67
+ cat output.log
Original file line number Diff line number Diff line change 1
- name : fast_testing
1
+ name : asan_testing
2
2
3
3
on :
4
4
push :
Original file line number Diff line number Diff line change @@ -22,10 +22,24 @@ else()
22
22
endif ()
23
23
message ("Found OPENSSL version: ${OPENSSL_VERSION} " )
24
24
25
+ option (ENABLE_ASAN OFF )
26
+ if (ENABLE_ASAN)
27
+ set (LIBRDKAFKA_C_FLAGS "-fsanitize=address" )
28
+ set (LIBRDKAFKA_CXX_FLAGS "-fsanitize=address" )
29
+ set (LIBRDKAFKA_FLAGS "--enable-devel" )
30
+ endif ()
31
+
25
32
if (STATIC_BUILD)
26
33
add_custom_command (
27
34
OUTPUT ${CMAKE_BINARY_DIR} /librdkafka/lib/librdkafka.a
28
- COMMAND ./configure --enable-ssl --disable-zstd --prefix =${CMAKE_BINARY_DIR} /librdkafka
35
+ COMMAND ./configure --enable-ssl
36
+ --disable-zstd
37
+ --prefix =${CMAKE_BINARY_DIR} /librdkafka
38
+ ${LIBRDKAFKA_FLAGS}
39
+ --cc=${CMAKE_C_COMPILER}
40
+ --cxx=${CMAKE_CXX_COMPILER}
41
+ --CFLAGS=${LIBRDKAFKA_C_FLAGS}
42
+ --CXXFLAGS=${LIBRDKAFKA_CXX_FLAGS}
29
43
COMMAND $(MAKE) -j
30
44
COMMAND $(MAKE) install
31
45
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} /librdkafka
Original file line number Diff line number Diff line change @@ -101,10 +101,8 @@ lua_consumer_msg_tostring(struct lua_State *L) {
101
101
if (msg -> key_len <= 0 || msg -> key == NULL ) {
102
102
memcpy (key , null_literal , sizeof (null_literal ));
103
103
} else {
104
- strncpy (key , msg -> key , msg -> key_len + 1 );
105
- if (key [msg -> key_len ] != '\0' ) {
106
- key [msg -> key_len ] = '\0' ;
107
- }
104
+ strncpy (key , msg -> key , msg -> key_len );
105
+ key [msg -> key_len ] = '\0' ;
108
106
}
109
107
110
108
size_t value_len = msg -> value_len <= 0 ? sizeof (null_literal ) : msg -> value_len + 1 ;
@@ -113,10 +111,8 @@ lua_consumer_msg_tostring(struct lua_State *L) {
113
111
if (msg -> value_len <= 0 || msg -> value == NULL ) {
114
112
memcpy (value , null_literal , sizeof (null_literal ));
115
113
} else {
116
- strncpy (value , msg -> value , msg -> value_len + 1 );
117
- if (value [msg -> value_len ] != '\0' ) {
118
- value [msg -> value_len ] = '\0' ;
119
- }
114
+ strncpy (value , msg -> value , msg -> value_len );
115
+ value [msg -> value_len ] = '\0' ;
120
116
}
121
117
122
118
lua_pushfstring (L ,
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def create_consumer(server, *args):
48
48
49
49
50
50
def write_into_kafka (topic , messages ):
51
- loop = asyncio .get_event_loop ()
51
+ loop = asyncio .get_event_loop_policy (). new_event_loop ()
52
52
53
53
async def send ():
54
54
producer = AIOKafkaProducer (bootstrap_servers = 'localhost:9092' )
@@ -74,6 +74,7 @@ async def send():
74
74
await producer .stop ()
75
75
76
76
loop .run_until_complete (send ())
77
+ loop .close ()
77
78
78
79
79
80
def test_consumer_should_consume_msgs ():
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def test_producer_should_produce_msgs():
33
33
]
34
34
server .call ("producer.produce" , [messages ])
35
35
36
- loop = asyncio .get_event_loop ()
36
+ loop = asyncio .get_event_loop_policy (). new_event_loop ()
37
37
38
38
async def test ():
39
39
kafka_output = []
@@ -73,6 +73,7 @@ async def consume():
73
73
assert kafka_output == messages
74
74
75
75
loop .run_until_complete (test ())
76
+ loop .close ()
76
77
77
78
server .call ("producer.close" , [])
78
79
You can’t perform that action at this time.
0 commit comments