All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] chdir/chdir01.c: Add ELOOP error number test
@ 2013-10-28  1:32 Zeng Linggang
  2013-10-31  2:01 ` Wanlong Gao
  0 siblings, 1 reply; 2+ messages in thread
From: Zeng Linggang @ 2013-10-28  1:32 UTC (permalink / raw)
  To: ltp-list

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

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
---
 testcases/kernel/syscalls/chdir/chdir01.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/chdir/chdir01.c b/testcases/kernel/syscalls/chdir/chdir01.c
index 04fb8b4..c4e74fb 100644
--- a/testcases/kernel/syscalls/chdir/chdir01.c
+++ b/testcases/kernel/syscalls/chdir/chdir01.c
@@ -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();
 
-- 
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-31  2:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-28  1:32 [LTP] [PATCH] chdir/chdir01.c: Add ELOOP error number test Zeng Linggang
2013-10-31  2:01 ` Wanlong Gao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.