master - tests: swith to mkstemp
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0a5edc1f12ddad72e0c34dddfecbb46cbfdb192f Commit: 0a5edc1f12ddad72e0c34dddfecbb46cbfdb192f Parent: 9640320aea74e7cef0bde64c9be6e3471a85746e Author: Zdenek Kabelac <[email protected]> AuthorDate: Sat May 12 23:23:54 2018 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Sat May 12 23:23:54 2018 +0200
tests: swith to mkstemp
As mkostemp is only on newer systems, switch to more old version which effectively does exactly the same thing for given list of open flags.
--- test/unit/bcache_utils_t.c | 2 +- test/unit/io_engine_t.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
test/unit/bcache_utils_t.c +1 -1
@@ -68,7 +68,7 @@ static void *_fix_init(struct io_engine *engine)T_ASSERT (f);snprintf (f->fname,sizeof (f->fname),"unit-test-XXXXXX" ); - f->fd =mkostemp (f->fname,O_RDWR |O_CREAT |O_EXCL ); + f->fd =mkstemp (f->fname);T_ASSERT (f->fd >=0 );for (b =0 ; b <NR_BLOCKS ; b++) {
test/unit/io_engine_t.c +4 -3
@@ -89,13 +89,14 @@ static void *_fix_init(void)test_fail ("posix_memalign failed" );snprintf (f->fname,sizeof (f->fname),"unit-test-XXXXXX" ); - f->fd =mkostemp (f->fname,O_RDWR |O_CREAT |O_EXCL ); + f->fd =mkstemp (f->fname);T_ASSERT (f->fd >=0 );_fill_buffer (f->data,123 ,SECTOR_SIZE *BLOCK_SIZE_SECTORS ); -write (f->fd, f->data,SECTOR_SIZE *BLOCK_SIZE_SECTORS ); -lseek (f->fd,0 ,SEEK_SET ); +T_ASSERT (write (f->fd, f->data,SECTOR_SIZE *BLOCK_SIZE_SECTORS ) >0 ); +T_ASSERT (lseek (f->fd,0 ,SEEK_SET ) !=-1 ); +return f; }