diff options
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-tools/0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch')
-rw-r--r-- | meta/recipes-kernel/lttng/lttng-tools/0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch b/meta/recipes-kernel/lttng/lttng-tools/0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch deleted file mode 100644 index 822b26a367..0000000000 --- a/meta/recipes-kernel/lttng/lttng-tools/0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | From 83d165442d1c3658b6bafa28ddade8ffee7092ad Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
3 | Date: Wed, 6 Mar 2019 16:46:49 -0500 | ||
4 | Subject: [PATCH lttng-tools 2/2] Fix: test: unit: the tree origin can be a | ||
5 | symlink itself | ||
6 | |||
7 | Problem: | ||
8 | |||
9 | The base tree is defined as "/tmp/.....XXXXXX". | ||
10 | On systems where "/tmp/" is itself a symlink utils_expand_path will | ||
11 | expand the tree origin itself. | ||
12 | |||
13 | For example on a base core-image-minimal Yocto build /tmp is a symlink | ||
14 | to "/var/tmp", which is a symlink to "/var/volatile". | ||
15 | |||
16 | utils_expand_path will return something like this for the symlink test: | ||
17 | "/var/volative/.....XXXXXX/...." which is the valid result. | ||
18 | |||
19 | Solution: | ||
20 | |||
21 | Simply use realpath on the tree_origin and use this path to perform the | ||
22 | test validation. | ||
23 | |||
24 | This work was performed in the effort to support yocto fully and be able | ||
25 | to run the test suite to detect problem as early as possible. | ||
26 | |||
27 | |||
28 | Upstream-Status: Accepted [f66e964a2e0c75f5e1a55fbcc963b1c5e2b4519d] | ||
29 | Backported to 2.11 and 2.10 | ||
30 | |||
31 | Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
32 | --- | ||
33 | tests/unit/test_utils_expand_path.c | 18 ++++++++++++++---- | ||
34 | 1 file changed, 14 insertions(+), 4 deletions(-) | ||
35 | |||
36 | diff --git a/tests/unit/test_utils_expand_path.c b/tests/unit/test_utils_expand_path.c | ||
37 | index d5cab002e..d047c207d 100644 | ||
38 | --- a/tests/unit/test_utils_expand_path.c | ||
39 | +++ b/tests/unit/test_utils_expand_path.c | ||
40 | @@ -281,8 +281,8 @@ error: | ||
41 | static void test_utils_expand_path(void) | ||
42 | { | ||
43 | char *result; | ||
44 | - char name[100], tmppath[PATH_MAX]; | ||
45 | - int i; | ||
46 | + char name[100], tmppath[PATH_MAX], real_tree_origin[PATH_MAX]; | ||
47 | + int i, treelen; | ||
48 | |||
49 | /* Test valid cases */ | ||
50 | for (i = 0; i < num_valid_tests; i++) { | ||
51 | @@ -295,14 +295,24 @@ static void test_utils_expand_path(void) | ||
52 | free(result); | ||
53 | } | ||
54 | |||
55 | + /* | ||
56 | + * Get the realpath for the tree_origin since it can itself be a | ||
57 | + * symlink. | ||
58 | + */ | ||
59 | + result = realpath(tree_origin, real_tree_origin); | ||
60 | + if (!result) { | ||
61 | + fail("realpath failed."); | ||
62 | + return; | ||
63 | + } | ||
64 | + | ||
65 | /* Test symlink tree cases */ | ||
66 | - int treelen = strlen(tree_origin) + 1; | ||
67 | + treelen = strlen(real_tree_origin) + 1; | ||
68 | for (i = 0; i < num_symlink_tests; i++) { | ||
69 | sprintf(name, "symlink tree test case: [tmppath/]%s", | ||
70 | symlink_tests_inputs[i].input); | ||
71 | |||
72 | snprintf(tmppath, PATH_MAX, "%s/%s", | ||
73 | - tree_origin, symlink_tests_inputs[i].input); | ||
74 | + real_tree_origin, symlink_tests_inputs[i].input); | ||
75 | result = utils_expand_path(tmppath); | ||
76 | ok(result != NULL && strcmp(result + treelen, | ||
77 | symlink_tests_inputs[i].expected_result) == 0, name); | ||
78 | -- | ||
79 | 2.17.1 | ||
80 | |||