Home | History | Annotate | Download | only in old
      1 /*
      2  * Copyright (c) 2016 Cyril Hrubis <chrubis (at) suse.cz>
      3  *
      4  * This program is free software: you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License as published by
      6  * the Free Software Foundation, either version 2 of the License, or
      7  * (at your option) any later version.
      8  *
      9  * This program is distributed in the hope that it will be useful,
     10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12  * GNU General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU General Public License
     15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
     16  */
     17 
     18 #ifndef OLD_TMPDIR_H__
     19 #define OLD_TMPDIR_H__
     20 
     21 /*
     22  * Create a unique temporary directory and chdir() to it. It expects the caller
     23  * to have defined/initialized the TCID/TST_TOTAL global variables.
     24  * The TESTDIR global variable will be set to the directory that gets used
     25  * as the testing directory.
     26  *
     27  * NOTE: This function must be called BEFORE any activity that would require
     28  * CLEANUP.  If tst_tmpdir() fails, it cleans up afer itself and calls
     29  * tst_exit() (i.e. does not return).
     30  */
     31 void tst_tmpdir(void);
     32 
     33 /*
     34  * Recursively remove the temporary directory created by tst_tmpdir().
     35  * This function is intended ONLY as a companion to tst_tmpdir().
     36  */
     37 void tst_rmdir(void);
     38 
     39 /* tst_get_tmpdir()
     40  *
     41  * Return a copy of the test temp directory as seen by LTP. This is for
     42  * path-oriented tests like chroot, etc, that may munge the path a bit.
     43  *
     44  * FREE VARIABLE AFTER USE IF IT IS REUSED!
     45  */
     46 char *tst_get_tmpdir(void);
     47 
     48 /*
     49  * Returns 1 if temp directory was created.
     50  */
     51 int tst_tmpdir_created(void);
     52 
     53 /* declared in tst_tmpdir.c */
     54 const char *tst_get_startwd(void);
     55 
     56 #endif	/* OLD_TMPDIR_H__ */
     57