Skip to contentSkip to conversation

A question on coredumps in unittests

DISCUSSION Willem Jan Withagen 2 participants 3 messages Apr 12, 2016

lore
Share & tools
lore
#0 lore raw

Hi Loic,

You have written a lot of the unittests, so it seems.

I'm having the issue that under FreeBSD the cores are left behind from the EXPECT_DAETH tests.
But under CentOS7 no cores are left behind.
And 'ulimit -c unlimited' does not help to get cores

Is there anything particular why this is the case...
Google tests suggest that it is the programs responsability to cleanup after itself.

And would there be any objections to adding code like:

	ret = RUN_ALL_TESTS();
	if (ret == 0) {
		char core [30];
		strncpy(core, argv[0], 19);
		core[19] = '\0';
		strcat(core, ".core");
		::unlink(core);
		free(core);
	}
	return ret;

to the tests

Thanx,
--WjW

#1 lore raw

Hi,

IIRC there needs to be a pattern defined for where core are to be found. For instance teuthology/task/internal.py has 'sudo', 'sysctl', '-w', 'kernel.core_pattern={adir}/coredump/%t.%p.core'.format(adir=archive_dir),

I hope that helps

Quoted 31 lines · Willem Jan Withagen

Hi Loic,

You have written a lot of the unittests, so it seems.

I'm having the issue that under FreeBSD the cores are left behind from the EXPECT_DAETH tests.
But under CentOS7 no cores are left behind.
And 'ulimit -c unlimited' does not help to get cores

Is there anything particular why this is the case...
Google tests suggest that it is the programs responsability to cleanup after itself.

And would there be any objections to adding code like:

    ret = RUN_ALL_TESTS();
    if (ret == 0) {
        char core [30];
        strncpy(core, argv[0], 19);
        core[19] = '\0';
        strcat(core, ".core");
        ::unlink(core);
        free(core);
    }
    return ret;

to the tests

Thanx,
--WjW

Signature · 5 lines
Loïc Dachary, Artisan Logiciel Libre
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 5 lines · Loic Dachary

Hi,

IIRC there needs to be a pattern defined for where core are to be found. For instance teuthology/task/internal.py has 'sudo', 'sysctl', '-w', 'kernel.core_pattern={adir}/coredump/%t.%p.core'.format(adir=archive_dir),

I hope that helps

Our local Linux Guru is out, so I can't harras him now, but this gives me a pointer.

Any objections to adding the code below?
(Even if only ifdefed for FreeBSD)

It keep the directory pollution a bit down.

--WjW

Quoted 34 lines · Willem Jan Withagen
Quoted 31 lines

Hi Loic,

You have written a lot of the unittests, so it seems.

I'm having the issue that under FreeBSD the cores are left behind from the EXPECT_DAETH tests.
But under CentOS7 no cores are left behind.
And 'ulimit -c unlimited' does not help to get cores

Is there anything particular why this is the case...
Google tests suggest that it is the programs responsability to cleanup after itself.

And would there be any objections to adding code like:

     ret = RUN_ALL_TESTS();
     if (ret == 0) {
         char core [30];
         strncpy(core, argv[0], 19);
         core[19] = '\0';
         strcat(core, ".core");
         ::unlink(core);
         free(core);
     }
     return ret;

to the tests

Thanx,
--WjW