Skip to contentSkip to conversation

chdir/chdir01.c: Add ELOOP error number test

PATCH Applied Zeng Linggang 2 participants 2 messages Oct 28, 2013 – Oct 31, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 chdir/chdir01.c: Add ELOOP error number test

Add ELOOP error number test in chdir01.c for chdir(2)

---
 testcases/kernel/syscalls/chdir/chdir01.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/chdir/chdir01.c +19 -2
index 04fb8b4..c4e74fb 100644
@@ -59,9 +59,9 @@
 #include "safe_macros.h"
 
 char *TCID = "chdir01";
-int TST_TOTAL = 1;
+int TST_TOTAL = 2;
 
-int exp_enos[] = { ENOTDIR, 0 };
+int exp_enos[] = { ENOTDIR, ELOOP, 0 };
 
 void setup(void);
 void cleanup(void);
@@ -120,6 +120,23 @@ int main(int ac, char **av)
 
 		SAFE_CHDIR(cleanup, "..");
 
+		/* ELOOP */
+		SAFE_SYMLINK(cleanup, "test_eloop1", "test_eloop2");
+		SAFE_SYMLINK(cleanup, "test_eloop2", "test_eloop1");
+
+		TEST(chdir("test_eloop1"));
+
+		if (TEST_RETURN != -1) {
+			tst_resm(TFAIL, "call succeeded unexpectedly");
+		} else if (TEST_ERRNO != ELOOP) {
+			tst_resm(TFAIL | TTERRNO,
+				 "failed unexpectedly; wanted ELOOP");
+		} else {
+			tst_resm(TPASS, "failed as expected with ELOOP");
+		}
+
+		SAFE_UNLINK(cleanup, "test_eloop1");
+		SAFE_UNLINK(cleanup, "test_eloop2");
 	}
 	cleanup();
 
Signature · 14 lines
1.8.2.1



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Applied
#1 lore raw
Quoted 6 lines · Zeng Linggang

Add ELOOP error number test in chdir01.c for chdir(2)

---
 testcases/kernel/syscalls/chdir/chdir01.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Applied, thank you.

Wanlong Gao

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list