Skip to content

Commit f3d5560

Browse files
committed
debug
1 parent 7712f33 commit f3d5560

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

.cirrus.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,9 @@ task:
246246
env:
247247
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
248248
FILE_ENV: "./ci/test/00_setup_env_native_fuzz.sh"
249-
python_script:
250-
- python src/test/fuzz/script.py
249+
# python_script:
250+
## - if [ "$CIRRUS_PR" = "" ]; then python src/test/fuzz/script.py; fi
251+
# - python src/test/fuzz/script.py
251252

252253
#task:
253254
# name: '[multiprocess, i686, DEBUG] [focal]'

src/test/fuzz/crypto_diff_fuzz_pychacha20.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ void send_to_python(int sockfd, uint32_t num)
140140
FUZZ_TARGET(crypto_diff_fuzz_pychacha20)
141141
{
142142
/* ----------------------- socket initialisation -------------------------- */
143+
std::cout << "socket initialisation\n";
143144
struct sockaddr_un addr;
144145

145146
// Create a new client socket with domain: AF_UNIX, type: SOCK_STREAM, protocol: 0
@@ -167,7 +168,9 @@ FUZZ_TARGET(crypto_diff_fuzz_pychacha20)
167168
exit(1);
168169
}
169170
/* ----------------------- initialisation over ----------------------- */
171+
std::cout << "socket initialisation over\n";
170172
/* ----------------------- fuzzing phase ------------------------------ */
173+
std::cout << "fuzzing initialisation\n";
171174
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
172175
ChaCha20 chacha20;
173176

@@ -180,7 +183,7 @@ FUZZ_TARGET(crypto_diff_fuzz_pychacha20)
180183
std::vector<unsigned char> response = read_from_python(sockfd);
181184
std::string s1(response.begin(), response.end());
182185
assert(s1 == "ok");
183-
186+
std::cout<<"py response obtained\n";
184187
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 3000)
185188
{
186189
CallOneOf(
@@ -214,5 +217,6 @@ FUZZ_TARGET(crypto_diff_fuzz_pychacha20)
214217
std::string s2(response.begin(), response.end());
215218
assert(s2 == "ok");
216219
/* ----------------------- end fuzzing phase ----------------------- */
220+
std::cout << "fuzzing over\n";
217221
close(sockfd);
218222
}

src/test/fuzz/script.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
os.remove("/tmp/socket_test.s")
1313

1414
def main():
15+
print("Script Hello!!!")
1516
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
16-
s.settimeout(60)
1717
s.bind("/tmp/socket_test.s")
1818
s.listen(1)
1919
while True:
@@ -71,4 +71,5 @@ def main():
7171
raise Exception("Unrecognised cmd")
7272

7373
if __name__ == "__main__":
74-
main()
74+
main()
75+
print("Script Bye!!!")

test/fuzz/test_runner.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ def main():
134134
logging.info("Please consider adding a fuzz corpus at https://github.com/bitcoin-core/qa-assets")
135135

136136
try:
137+
if 'crypto_diff_fuzz_pychacha20' in args.target:
138+
# # output += "hi"
139+
theproc =subprocess.Popen('src/test/fuzz/script.py', shell = True)
140+
theproc.communicate()
141+
# check if socket is still connected
142+
# # sleep(10)
143+
# # output += "bye"
137144
help_output = subprocess.run(
138145
args=[
139146
os.path.join(config["environment"]["BUILDDIR"], 'src', 'test', 'fuzz', 'fuzz'),
@@ -217,7 +224,7 @@ def job(command, t):
217224
for future in as_completed(futures):
218225
future.result()
219226

220-
227+
# todo: what's this?
221228
def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir):
222229
logging.info("Merge the inputs from the passed dir into the corpus_dir. Passed dir {}".format(merge_dir))
223230
jobs = []
@@ -266,6 +273,12 @@ def run_once(*, fuzz_pool, corpus, test_list, src_dir, build_dir, use_valgrind):
266273

267274
def job(t, args):
268275
output = 'Run {} with args {}'.format(t, args)
276+
# import ipdb; ipdb.set_trace()
277+
# if t == 'crypto_diff_fuzz_pychacha20':
278+
# output += "hi"
279+
# subprocess.Popen(['python','src/test/fuzz/script.py'])
280+
# sleep(10)
281+
# output += "bye"
269282
result = subprocess.run(
270283
args,
271284
env=get_fuzz_env(target=t, source_dir=src_dir),

0 commit comments

Comments
 (0)