All of lore.kernel.org
 help / color / mirror / Atom feed
* [ptest-runner][PATCHv2 1/3] Makefile: libcheck now requires to link subunit
@ 2017-12-07 23:42 Aníbal Limón
  2017-12-07 23:42 ` [ptest-runner][PATCHv2 2/3] Add support to avoid load/run twice a run_ptest script Aníbal Limón
  2017-12-07 23:42 ` [ptest-runner][PATCHv2 3/3] README.md: Update to my current email Aníbal Limón
  0 siblings, 2 replies; 4+ messages in thread
From: Aníbal Limón @ 2017-12-07 23:42 UTC (permalink / raw)
  To: yocto; +Cc: joshua.g.lock, Aníbal Limón

From: Aníbal Limón <anibal.limon@linaro.org>

Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 434b89f..1bde7be 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ TEST_SOURCES=tests/main.c tests/ptest_list.c tests/utils.c $(BASE_SOURCES)
 TEST_OBJECTS=$(TEST_SOURCES:.c=.o)
 TEST_EXECUTABLE=ptest-runner-test
 TEST_LDFLAGS=-lm -lrt -lpthread
-TEST_LIBSTATIC=-lcheck
+TEST_LIBSTATIC=-lcheck -lsubunit
 
 TEST_DATA=$(shell echo `pwd`/tests/data)
 
-- 
2.11.0



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

* [ptest-runner][PATCHv2 2/3] Add support to avoid load/run twice a run_ptest script
  2017-12-07 23:42 [ptest-runner][PATCHv2 1/3] Makefile: libcheck now requires to link subunit Aníbal Limón
@ 2017-12-07 23:42 ` Aníbal Limón
  2017-12-07 23:45   ` Anibal Limón
  2017-12-07 23:42 ` [ptest-runner][PATCHv2 3/3] README.md: Update to my current email Aníbal Limón
  1 sibling, 1 reply; 4+ messages in thread
From: Aníbal Limón @ 2017-12-07 23:42 UTC (permalink / raw)
  To: yocto; +Cc: joshua.g.lock, Aníbal Limón

From: Aníbal Limón <anibal.limon@linaro.org>

In some ptest packages exists symlink in the ptest directory causing
to load/run twice the same ptest,

For example in perl5:

/usr/lib/perl -> /usr/lib/perl5

Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
---
 ptest_list.c       | 40 ++++++++++++++++++++++++++++++++++++++++
 ptest_list.h       |  3 +++
 tests/data/python3 |  1 +
 tests/utils.c      |  1 +
 utils.c            |  6 ++++++
 5 files changed, 51 insertions(+)
 create mode 120000 tests/data/python3

diff --git a/ptest_list.c b/ptest_list.c
index 2e1aa30..3e393d5 100644
--- a/ptest_list.c
+++ b/ptest_list.c
@@ -110,6 +110,46 @@ ptest_list_search(struct ptest_list *head, char *ptest)
 	return q;
 }
 
+
+struct ptest_list *
+ptest_list_search_by_file(struct ptest_list *head, char *run_ptest, struct stat st_buf)
+{
+	struct ptest_list *q = NULL;
+	struct ptest_list *p;
+	struct stat st_buf_p;
+
+	VALIDATE_PTR_RNULL(head);
+	VALIDATE_PTR_RNULL(run_ptest);
+
+	for (p = head; p != NULL; p = p->next) {
+		if (p->ptest == NULL) 
+			continue;
+
+		if (stat(p->run_ptest, &st_buf_p) == -1)
+			continue;
+
+		if (strcmp(p->run_ptest, run_ptest) == 0) {
+			q = p;
+			break;
+		}
+
+		/* *
+		 * In some ptest packages exists symlink in the ptest directory
+		 * causing to load/run twice the same ptest, 
+		 *
+		 * For example in perl5:
+		 * /usr/lib/perl -> /usr/lib/perl5
+		 * */
+		if (st_buf.st_dev == st_buf_p.st_dev &&
+		    st_buf.st_ino == st_buf_p.st_ino) {
+			q = p;
+			break;
+		}
+	}
+
+	return q;
+}
+
 struct ptest_list *
 ptest_list_add(struct ptest_list *head, char *ptest, char *run_ptest)
 {
diff --git a/ptest_list.h b/ptest_list.h
index 8b39485..03d7539 100644
--- a/ptest_list.h
+++ b/ptest_list.h
@@ -28,6 +28,8 @@
 #define PTEST_LIST_ITERATE_START(head, p) for (p = head->next; p != NULL; p = p->next) { 
 #define PTEST_LIST_ITERATE_END }
 
+#include <sys/stat.h>
+
 struct ptest_list {
 	char *ptest;
 	char *run_ptest;
@@ -42,6 +44,7 @@ extern int ptest_list_free_all(struct ptest_list *);
 
 extern int ptest_list_length(struct ptest_list *);
 extern struct ptest_list *ptest_list_search(struct ptest_list *, char *);
+extern struct ptest_list *ptest_list_search_by_file(struct ptest_list *, char *, struct stat);
 extern struct ptest_list *ptest_list_add(struct ptest_list *, char *, char *);
 extern struct ptest_list *ptest_list_remove(struct ptest_list *, char *, int);
 
diff --git a/tests/data/python3 b/tests/data/python3
new file mode 120000
index 0000000..d8654aa
--- /dev/null
+++ b/tests/data/python3
@@ -0,0 +1 @@
+python
\ No newline at end of file
diff --git a/tests/utils.c b/tests/utils.c
index ecf3e8a..cf09379 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -48,6 +48,7 @@ static int ptests_found_length = 6;
 static char *ptests_not_found[] = {
 	"busybox",
 	"perl",
+	"python3",
 	NULL,
 };
 
diff --git a/utils.c b/utils.c
index 933eced..ed2eff7 100644
--- a/utils.c
+++ b/utils.c
@@ -143,6 +143,12 @@ get_available_ptests(const char *dir)
 				continue;
 			}
 
+			if (ptest_list_search_by_file(head, run_ptest, st_buf)) {
+				free(run_ptest);
+				free(d_name);
+				continue;
+			}
+
 			struct ptest_list *p = ptest_list_add(head,
 				d_name, run_ptest);
 			CHECK_ALLOCATION(p, sizeof(struct ptest_list *), 0);
-- 
2.11.0



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

* [ptest-runner][PATCHv2 3/3] README.md: Update to my current email
  2017-12-07 23:42 [ptest-runner][PATCHv2 1/3] Makefile: libcheck now requires to link subunit Aníbal Limón
  2017-12-07 23:42 ` [ptest-runner][PATCHv2 2/3] Add support to avoid load/run twice a run_ptest script Aníbal Limón
@ 2017-12-07 23:42 ` Aníbal Limón
  1 sibling, 0 replies; 4+ messages in thread
From: Aníbal Limón @ 2017-12-07 23:42 UTC (permalink / raw)
  To: yocto; +Cc: joshua.g.lock, Aníbal Limón

From: Aníbal Limón <anibal.limon@linaro.org>

Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index fedab04..22b36a4 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ $ mtrace ./ptest-runner $(MALLOC_TRACE)
 
 For contribute please send a patch with subject prefix "[ptest-runner]" to 
 yocto@yoctoproject.org and cc the current maintainer that is Aníbal Limón 
-<anibal.limon@linux.intel.com>.
+<anibal.limon@linaro.org>.
 
 ## Links
 
-- 
2.11.0



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

* Re: [ptest-runner][PATCHv2 2/3] Add support to avoid load/run twice a run_ptest script
  2017-12-07 23:42 ` [ptest-runner][PATCHv2 2/3] Add support to avoid load/run twice a run_ptest script Aníbal Limón
@ 2017-12-07 23:45   ` Anibal Limón
  0 siblings, 0 replies; 4+ messages in thread
From: Anibal Limón @ 2017-12-07 23:45 UTC (permalink / raw)
  To: yocto; +Cc: Joshua Lock, Aníbal Limón

[-- Attachment #1: Type: text/plain, Size: 4516 bytes --]

On Thu, Dec 7, 2017 at 5:42 PM, Aníbal Limón <limon.anibal@gmail.com> wrote:

> From: Aníbal Limón <anibal.limon@linaro.org>
>
> In some ptest packages exists symlink in the ptest directory causing
> to load/run twice the same ptest,
>
> For example in perl5:
>
> /usr/lib/perl -> /usr/lib/perl5
>
> Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
> ---
>  ptest_list.c       | 40 ++++++++++++++++++++++++++++++++++++++++
>  ptest_list.h       |  3 +++
>  tests/data/python3 |  1 +
>  tests/utils.c      |  1 +
>  utils.c            |  6 ++++++
>  5 files changed, 51 insertions(+)
>  create mode 120000 tests/data/python3
>
> diff --git a/ptest_list.c b/ptest_list.c
> index 2e1aa30..3e393d5 100644
> --- a/ptest_list.c
> +++ b/ptest_list.c
> @@ -110,6 +110,46 @@ ptest_list_search(struct ptest_list *head, char
> *ptest)
>         return q;
>  }
>
> +
> +struct ptest_list *
> +ptest_list_search_by_file(struct ptest_list *head, char *run_ptest,
> struct stat st_buf)
> +{
> +       struct ptest_list *q = NULL;
> +       struct ptest_list *p;
> +       struct stat st_buf_p;
> +
> +       VALIDATE_PTR_RNULL(head);
> +       VALIDATE_PTR_RNULL(run_ptest);
> +
> +       for (p = head; p != NULL; p = p->next) {
> +               if (p->ptest == NULL)
> +                       continue;
> +
> +               if (stat(p->run_ptest, &st_buf_p) == -1)
> +                       continue;
> +
> +               if (strcmp(p->run_ptest, run_ptest) == 0) {
> +                       q = p;
> +                       break;
> +               }
> +
> +               /* *
> +                * In some ptest packages exists symlink in the ptest
> directory
> +                * causing to load/run twice the same ptest,
> +                *
> +                * For example in perl5:
> +                * /usr/lib/perl -> /usr/lib/perl5
> +                * */
> +               if (st_buf.st_dev == st_buf_p.st_dev &&
> +                   st_buf.st_ino == st_buf_p.st_ino) {
> +                       q = p;
> +                       break;
> +               }
> +       }
> +
> +       return q;
> +}
> +
>  struct ptest_list *
>  ptest_list_add(struct ptest_list *head, char *ptest, char *run_ptest)
>  {
> diff --git a/ptest_list.h b/ptest_list.h
> index 8b39485..03d7539 100644
> --- a/ptest_list.h
> +++ b/ptest_list.h
> @@ -28,6 +28,8 @@
>  #define PTEST_LIST_ITERATE_START(head, p) for (p = head->next; p != NULL;
> p = p->next) {
>  #define PTEST_LIST_ITERATE_END }
>
> +#include <sys/stat.h>
> +
>  struct ptest_list {
>         char *ptest;
>         char *run_ptest;
> @@ -42,6 +44,7 @@ extern int ptest_list_free_all(struct ptest_list *);
>
>  extern int ptest_list_length(struct ptest_list *);
>  extern struct ptest_list *ptest_list_search(struct ptest_list *, char *);
> +extern struct ptest_list *ptest_list_search_by_file(struct ptest_list *,
> char *, struct stat);
>  extern struct ptest_list *ptest_list_add(struct ptest_list *, char *,
> char *);
>  extern struct ptest_list *ptest_list_remove(struct ptest_list *, char *,
> int);
>
> diff --git a/tests/data/python3 b/tests/data/python3
> new file mode 120000
> index 0000000..d8654aa
> --- /dev/null
> +++ b/tests/data/python3
>

I forget to add symlink of python3 to python, used in testing.

Cheers,
Anibal


> @@ -0,0 +1 @@
> +python
> \ No newline at end of file
> diff --git a/tests/utils.c b/tests/utils.c
> index ecf3e8a..cf09379 100644
> --- a/tests/utils.c
> +++ b/tests/utils.c
> @@ -48,6 +48,7 @@ static int ptests_found_length = 6;
>  static char *ptests_not_found[] = {
>         "busybox",
>         "perl",
> +       "python3",
>         NULL,
>  };
>
> diff --git a/utils.c b/utils.c
> index 933eced..ed2eff7 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -143,6 +143,12 @@ get_available_ptests(const char *dir)
>                                 continue;
>                         }
>
> +                       if (ptest_list_search_by_file(head, run_ptest,
> st_buf)) {
> +                               free(run_ptest);
> +                               free(d_name);
> +                               continue;
> +                       }
> +
>                         struct ptest_list *p = ptest_list_add(head,
>                                 d_name, run_ptest);
>                         CHECK_ALLOCATION(p, sizeof(struct ptest_list *),
> 0);
> --
> 2.11.0
>
>

[-- Attachment #2: Type: text/html, Size: 5981 bytes --]

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

end of thread, other threads:[~2017-12-07 23:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-07 23:42 [ptest-runner][PATCHv2 1/3] Makefile: libcheck now requires to link subunit Aníbal Limón
2017-12-07 23:42 ` [ptest-runner][PATCHv2 2/3] Add support to avoid load/run twice a run_ptest script Aníbal Limón
2017-12-07 23:45   ` Anibal Limón
2017-12-07 23:42 ` [ptest-runner][PATCHv2 3/3] README.md: Update to my current email Aníbal Limón

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.