1 /*
2  * Copyright (C) 2014 Linux Test Project, Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of version 2 of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it would be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *
12  * Further, this software is distributed without any warranty that it is
13  * free of the rightful claim of any third person regarding infringement
14  * or the like.  Any license provided herein, whether implied or
15  * otherwise, applies only to this software file.  Patent licenses, if
16  * any, provided herein do not apply to combinations of this program with
17  * other software, or any other product whatsoever.
18  */
19 
20 #include <errno.h>
21 #include <fcntl.h>
22 #include <string.h>
23 #include "test.h"
24 #include "safe_macros.h"
25 
26 #define OUTPUT_FNAME "output"
27 #define LTPROOT "/opt/ltp"
28 
29 char *TCID = "dataroot";
30 int TST_TOTAL = 1;
31 
cmp_paths(const char * p1,const char * p2,const char * s)32 static void cmp_paths(const char *p1, const char *p2, const char *s)
33 {
34 	if (strncmp(p1, p2, PATH_MAX) == 0)
35 		tst_resm(TPASS, "%s", s);
36 	else
37 		tst_resm(TFAIL, "%s, %s != %s", s, p1, p2);
38 }
39 
main(void)40 int main(void)
41 {
42 	const char *dataroot;
43 	char tmp[PATH_MAX];
44 
45 	/* LTPROOT */
46 	setenv("LTPROOT", LTPROOT, 1);
47 	dataroot = tst_dataroot();
48 	snprintf(tmp, PATH_MAX, "%s/testcases/data/%s", LTPROOT, TCID);
49 	cmp_paths(dataroot, tmp, "LTPROOT, no tmpdir, "
50 		"dataroot == $LTPROOT/testcases/data/$TCID");
51 
52 	tst_exit();
53 }
54 
55