Skip to contentSkip to conversation

tools: Fixes for pcitest

PATCH Applied Kishon Vijay Abraham I 2 participants 4 messages Apr 4, 2019 – Apr 11, 2019 PCI

lore
Share & tools
lore
#0 lore raw

cover tools: Fixes for pcitest

Hi Lorenzo,

This series includes a couple of patches, one which fixes inadvertent removal of pcitest.sh from kernel repo when doing a "clean" and other lets the user use 'h' option to display the list of options supported by pcitest.

Thanks
Kishon

Kishon Vijay Abraham I (2):
tools: PCI: Add 'h' in optstring of getopt()
tools: PCI: Handle pcitest.sh independently from pcitest

 tools/pci/Makefile  | 8 +++++++-
 tools/pci/pcitest.c | 4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 tools: PCI: Add 'h' in optstring of getopt()

'h' is a valid option character for pcitest utility used to print the pcitest usage. Add 'h' in optstring of getopt() in order to get rid of "pcitest: invalid option -- 'h'" warning. While at that remove unncessary case '?'.

---
 tools/pci/pcitest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/pci/pcitest.c +2 -2
index ec4d51f3308b..34d71f7d3b12 100644
@@ -162,7 +162,7 @@ int main(int argc, char **argv)
 	/* set default endpoint device */
 	test->device = "/dev/pci-endpoint-test.0";
 
-	while ((c = getopt(argc, argv, "D:b:m:x:i:Ilrwcs:")) != EOF)
+	while ((c = getopt(argc, argv, "D:b:m:x:i:Ilhrwcs:")) != EOF)
 	switch (c) {
 	case 'D':
 		test->device = optarg;
@@ -206,7 +206,6 @@ int main(int argc, char **argv)
 	case 's':
 		test->size = strtoul(optarg, NULL, 0);
 		continue;
-	case '?':
 	case 'h':
 	default:
 usage:
@@ -224,6 +223,7 @@ int main(int argc, char **argv)
 			"\t-w			Write buffer test\n"
 			"\t-c			Copy buffer test\n"
 			"\t-s <size>		Size of buffer {default: 100KB}\n",
+			"\t-h			Print this help message\n",
 			argv[0]);
 		return -EINVAL;
 	}
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 tools: PCI: Handle pcitest.sh independently from pcitest

In reply to Kishon Vijay Abraham I

Handling pcitest.sh along with pcitest (obtained by compiling pcitest.c) results in pcitest.sh getting removed inadvertently while "make -C tools/pci clean". Fix it here by handling pcitest.sh independently of pcitest.

Fixes 1ce78ce09430a5f ("tools: PCI: Change pcitest compiling

process")

---
 tools/pci/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tools/pci/Makefile +7 -1
index 46e4c2f318c9..9b7534457060 100644
@@ -14,9 +14,12 @@ MAKEFLAGS += -r
 
 CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
 
-ALL_TARGETS := pcitest pcitest.sh
+ALL_TARGETS := pcitest
 ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
 
+SCRIPTS := pcitest.sh
+ALL_SCRIPTS := $(patsubst %,$(OUTPUT)%,$(SCRIPTS))
+
 all: $(ALL_PROGRAMS)
 
 export srctree OUTPUT CC LD CFLAGS
@@ -46,6 +49,9 @@ install: $(ALL_PROGRAMS)
 	install -d -m 755 $(DESTDIR)$(bindir);		\
 	for program in $(ALL_PROGRAMS); do		\
 		install $$program $(DESTDIR)$(bindir);	\
+	done;						\
+	for script in $(ALL_SCRIPTS); do		\
+		install $$script $(DESTDIR)$(bindir);	\
 	done
 
 FORCE:
Signature · 1 line
2.17.1
#3 lore raw
In reply to Kishon Vijay Abraham I
Quoted 10 lines · Kishon Vijay Abraham I

Hi Lorenzo,

This series includes a couple of patches, one which fixes inadvertent removal of pcitest.sh from kernel repo when doing a "clean" and other lets the user use 'h' option to display the list of options supported by pcitest.

Thanks
Kishon

Quoted 7 lines

Kishon Vijay Abraham I (2):
tools: PCI: Add 'h' in optstring of getopt()
tools: PCI: Handle pcitest.sh independently from pcitest

 tools/pci/Makefile  | 8 +++++++-
 tools/pci/pcitest.c | 4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)

Applied to pci/misc for v5.2, thanks.

Lorenzo