From 0684c35c258033e6c374ff6611771188a1cd9271 Mon Sep 17 00:00:00 2001 From: Fei Jie Date: Wed, 11 May 2016 15:07:28 +0800 Subject: [PATCH] tests: add link.test * tests/link.c: New file. * tests/link.test: New test. * tests/.gitignore: Add link. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add link.test. --- tests/.gitignore | 1 + tests/Makefile.am | 2 ++ tests/link.c | 27 +++++++++++++++++++++++++++ tests/link.test | 6 ++++++ 4 files changed, 36 insertions(+) create mode 100644 tests/link.c create mode 100755 tests/link.test diff --git a/tests/.gitignore b/tests/.gitignore index fbcc8baf..acf92c8b 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -103,6 +103,7 @@ ksysent.h lchown lchown32 libtests.a +link linkat llseek lseek diff --git a/tests/Makefile.am b/tests/Makefile.am index 00cf8270..34616d4e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -156,6 +156,7 @@ check_PROGRAMS = \ ksysent \ lchown \ lchown32 \ + link \ linkat \ llseek \ lseek \ @@ -438,6 +439,7 @@ DECODER_TESTS = \ kill.test \ lchown.test \ lchown32.test \ + link.test \ linkat.test \ llseek.test \ lseek.test \ diff --git a/tests/link.c b/tests/link.c new file mode 100644 index 00000000..4b84e416 --- /dev/null +++ b/tests/link.c @@ -0,0 +1,27 @@ +#include "tests.h" +#include + +#ifdef __NR_link + +# include +# include + +int +main(void) +{ + static const char sample_1[] = "link_sample_old"; + static const char sample_2[] = "link_sample_new"; + + long rc = syscall(__NR_link, sample_1, sample_2); + printf("link(\"%s\", \"%s\") = %ld %s (%m)\n", + sample_1, sample_2, rc, errno2name()); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_link") + +#endif diff --git a/tests/link.test b/tests/link.test new file mode 100755 index 00000000..cfa2b0cc --- /dev/null +++ b/tests/link.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check link syscall decoding. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -- 2.40.0