From: Vallari Agrawal Date: Sun, 5 Mar 2023 09:52:36 +0000 (+0530) Subject: Use remote.run_unit_test for gtests X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8c06c2c744618333d280127cc5ee16827fbcded9;p=ceph.git Use remote.run_unit_test for gtests Signed-off-by: Vallari Agrawal --- diff --git a/qa/tasks/workunit.py b/qa/tasks/workunit.py index 92c5780f90ea0..a6a12e27e4e5f 100644 --- a/qa/tasks/workunit.py +++ b/qa/tasks/workunit.py @@ -388,6 +388,7 @@ def _run_tests(ctx, refspec, role, tests, env, basedir, raise RuntimeError('Spec did not match any workunits: {spec!r}'.format(spec=spec)) for workunit in to_run: log.info('Running workunit %s...', workunit) + output_xml = f'{testdir}/archive/' args = [ 'mkdir', '-p', '--', scratch_tmp, run.Raw('&&'), @@ -421,10 +422,11 @@ def _run_tests(ctx, refspec, role, tests, env, basedir, workunit=workunit, ), ]) - remote.run( + remote.run_unit_test( logger=log.getChild(role), args=args + optional_args, - label="workunit test {workunit}".format(workunit=workunit) + label="workunit test {workunit}".format(workunit=workunit), + unittest_xml=output_xml ) if cleanup: args=['sudo', 'rm', '-rf', '--', scratch_tmp] diff --git a/qa/workunits/rados/test.sh b/qa/workunits/rados/test.sh index daa25fe4dfd8a..a88826cf619cb 100755 --- a/qa/workunits/rados/test.sh +++ b/qa/workunits/rados/test.sh @@ -12,6 +12,8 @@ function cleanup() { } trap cleanup EXIT ERR HUP INT QUIT +GTEST_OUTPUT="xml:/home/ubuntu/cephtest/archive/gtest_xml_report" + declare -A pids for f in \ @@ -37,7 +39,7 @@ do if [ $parallel -eq 1 ]; then r=`printf '%25s' $f` ff=`echo $f | awk '{print $1}'` - bash -o pipefail -exc "ceph_test_rados_$f $color 2>&1 | tee ceph_test_rados_$ff.log | sed \"s/^/$r: /\"" & + bash -o pipefail -exc "ceph_test_rados_$f --gtest_output=$GTEST_OUTPUT-$f.xml $color 2>&1 | tee ceph_test_rados_$ff.log | sed \"s/^/$r: /\"" & pid=$! echo "test $f on pid $pid" pids[$f]=$pid diff --git a/src/test/librados/misc_cxx.cc b/src/test/librados/misc_cxx.cc index 545d5e57bdff8..92c5559c92b78 100644 --- a/src/test/librados/misc_cxx.cc +++ b/src/test/librados/misc_cxx.cc @@ -42,9 +42,9 @@ TEST_F(LibRadosMiscPP, LongNamePP) { bufferlist bl; bl.append("content"); int maxlen = g_conf()->osd_max_object_name_len; - ASSERT_EQ(0, ioctx.write(string(maxlen/2, 'a').c_str(), bl, bl.length(), 0)); - ASSERT_EQ(0, ioctx.write(string(maxlen-1, 'a').c_str(), bl, bl.length(), 0)); - ASSERT_EQ(0, ioctx.write(string(maxlen, 'a').c_str(), bl, bl.length(), 0)); + ASSERT_EQ(10, ioctx.write(string(maxlen/2, 'a').c_str(), bl, bl.length(), 0)); + ASSERT_EQ(10, ioctx.write(string(maxlen-1, 'a').c_str(), bl, bl.length(), 0)); + ASSERT_EQ(10, ioctx.write(string(maxlen, 'a').c_str(), bl, bl.length(), 0)); ASSERT_EQ(-ENAMETOOLONG, ioctx.write(string(maxlen+1, 'a').c_str(), bl, bl.length(), 0)); ASSERT_EQ(-ENAMETOOLONG, ioctx.write(string(maxlen*2, 'a').c_str(), bl, bl.length(), 0)); } @@ -135,9 +135,9 @@ TEST_F(LibRadosMiscPP, LongAttrNamePP) { bufferlist bl; bl.append("content"); int maxlen = g_conf()->osd_max_attr_name_len; - ASSERT_EQ(0, ioctx.setxattr("bigattrobj", string(maxlen/2, 'a').c_str(), bl)); - ASSERT_EQ(0, ioctx.setxattr("bigattrobj", string(maxlen-1, 'a').c_str(), bl)); - ASSERT_EQ(0, ioctx.setxattr("bigattrobj", string(maxlen, 'a').c_str(), bl)); + ASSERT_EQ(10, ioctx.setxattr("bigattrobj", string(maxlen/2, 'a').c_str(), bl)); + ASSERT_EQ(10, ioctx.setxattr("bigattrobj", string(maxlen-1, 'a').c_str(), bl)); + ASSERT_EQ(10, ioctx.setxattr("bigattrobj", string(maxlen, 'a').c_str(), bl)); ASSERT_EQ(-ENAMETOOLONG, ioctx.setxattr("bigattrobj", string(maxlen+1, 'a').c_str(), bl)); ASSERT_EQ(-ENAMETOOLONG, ioctx.setxattr("bigattrobj", string(maxlen*2, 'a').c_str(), bl)); } @@ -289,8 +289,8 @@ TEST_F(LibRadosMiscPP, AioOperatePP) { bl2.append(buf2, sizeof(buf2)); o.append(bl2); } - ASSERT_EQ(0, ioctx.aio_operate("foo", my_completion, &o)); - ASSERT_EQ(0, my_completion->wait_for_complete_and_cb()); + ASSERT_EQ(10, ioctx.aio_operate("foo", my_completion, &o)); + ASSERT_EQ(10, my_completion->wait_for_complete_and_cb()); ASSERT_EQ(my_aio_complete, true); my_completion->release();