xref: /llvm-project/compiler-rt/test/scudo/preload.cpp (revision f7c5c0d87b8ae5e55006fd3a31994cd68d64f102)
1*f7c5c0d8SMitch Phillips // Test that the preloaded runtime works without linking the static library.
2*f7c5c0d8SMitch Phillips 
3*f7c5c0d8SMitch Phillips // RUN: %clang %s -lstdc++ -o %t
4*f7c5c0d8SMitch Phillips // RUN: env LD_PRELOAD=%shared_libscudo    not %run %t 2>&1 | FileCheck %s
5*f7c5c0d8SMitch Phillips // RUN: env LD_PRELOAD=%shared_minlibscudo not %run %t 2>&1 | FileCheck %s
6*f7c5c0d8SMitch Phillips 
7*f7c5c0d8SMitch Phillips // This way of setting LD_PRELOAD does not work with Android test runner.
8*f7c5c0d8SMitch Phillips // REQUIRES: !android
9*f7c5c0d8SMitch Phillips 
10*f7c5c0d8SMitch Phillips #include <assert.h>
11*f7c5c0d8SMitch Phillips 
main(int argc,char * argv[])12*f7c5c0d8SMitch Phillips int main(int argc, char *argv[]) {
13*f7c5c0d8SMitch Phillips   int *p = new int;
14*f7c5c0d8SMitch Phillips   assert(p);
15*f7c5c0d8SMitch Phillips   *p = 0;
16*f7c5c0d8SMitch Phillips   delete p;
17*f7c5c0d8SMitch Phillips   delete p;
18*f7c5c0d8SMitch Phillips   return 0;
19*f7c5c0d8SMitch Phillips }
20*f7c5c0d8SMitch Phillips 
21*f7c5c0d8SMitch Phillips // CHECK: ERROR: invalid chunk state
22