| Revision 868,
859 bytes
checked in by Freddie Akeroyd, 5 years ago
(diff) |
|
Add script for running leak tests with useful valgrind arguments
Refs #31
|
| Line | |
|---|
| 1 | #include <stdio.h> |
|---|
| 2 | #include <unistd.h> |
|---|
| 3 | #include <stdlib.h> |
|---|
| 4 | #include <napi.h> |
|---|
| 5 | |
|---|
| 6 | int main (int argc, char* argv[]) |
|---|
| 7 | { |
|---|
| 8 | NXaccess access_mode = NXACC_CREATE5; |
|---|
| 9 | const int nReOpen = 1000; |
|---|
| 10 | printf("Running for %d iterations\n", nReOpen); |
|---|
| 11 | int iReOpen; |
|---|
| 12 | const char* szFile = "leak_test1.nxs"; |
|---|
| 13 | |
|---|
| 14 | NXhandle fileid; |
|---|
| 15 | unlink(szFile); |
|---|
| 16 | if (NXopen(szFile, access_mode, &fileid) != NX_OK) return 1; |
|---|
| 17 | if( NXclose(&fileid) != NX_OK) return 1; |
|---|
| 18 | for( iReOpen = 0; iReOpen < nReOpen; iReOpen++ ) |
|---|
| 19 | { |
|---|
| 20 | if( 0 == iReOpen % 100 ) |
|---|
| 21 | printf("loop count %d\n", iReOpen); |
|---|
| 22 | if( NXopen(szFile, NXACC_RDWR, &fileid ) != NX_OK) return 1; |
|---|
| 23 | if( NXclose(&fileid) != NX_OK ) return 1; |
|---|
| 24 | } |
|---|
| 25 | unlink(szFile); |
|---|
| 26 | fileid = NULL; |
|---|
| 27 | _exit(EXIT_FAILURE); |
|---|
| 28 | return 0; |
|---|
| 29 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.