mirror of
https://github.com/apache/impala.git
synced 2026-01-24 06:00:49 -05:00
Update promise failure test to never generate core dumps.
Change-Id: I02f825244eac136211e2435450c43a15a97ea027 Reviewed-on: http://gerrit.ent.cloudera.com:8080/356 Reviewed-by: Nong Li <nong@cloudera.com> Tested-by: Nong Li <nong@cloudera.com>
This commit is contained in:
@@ -16,12 +16,30 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <boost/thread.hpp>
|
||||
#include <sys/resource.h>
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace impala {
|
||||
|
||||
struct ScopedLimitResetter {
|
||||
public:
|
||||
ScopedLimitResetter() {
|
||||
getrlimit(RLIMIT_CORE, &limit_before_);
|
||||
rlimit limit;
|
||||
limit.rlim_cur = limit.rlim_max = 0;
|
||||
setrlimit(RLIMIT_CORE, &limit);
|
||||
}
|
||||
|
||||
~ScopedLimitResetter() {
|
||||
setrlimit(RLIMIT_CORE, &limit_before_);
|
||||
}
|
||||
|
||||
private:
|
||||
rlimit limit_before_;
|
||||
};
|
||||
|
||||
void RunThread(Promise<int64_t>* promise) {
|
||||
promise->Set(100);
|
||||
}
|
||||
@@ -34,6 +52,9 @@ TEST(PromiseTest, BasicTest) {
|
||||
}
|
||||
|
||||
TEST(PromiseDeathTest, RepeatedSetTest) {
|
||||
// This test intentionally causes a crash. Don't generate core files for it.
|
||||
ScopedLimitResetter resetter;
|
||||
|
||||
// Hint to gtest that only one thread is being used here. Multiple threads are unsafe
|
||||
// for 'death' tests, see
|
||||
// https://code.google.com/p/googletest/wiki/AdvancedGuide#Death_Tests for more detail
|
||||
|
||||
Reference in New Issue
Block a user