Skip to contentSkip to conversation

test: remove meson dependency on /proc file

PATCH Superseded Thomas Monjalon 7 participants 24 messages Apr 9, 2020 – Apr 15, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: remove meson dependency on /proc file

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")
---
 MAINTAINERS              |  1 +
 app/test/has-hugepage.sh | 11 +++++++++++
 app/test/meson.build     |  8 ++------
 3 files changed, 14 insertions(+), 6 deletions(-)
 create mode 100755 app/test/has-hugepage.sh
MAINTAINERS +1 -0
index 4800f6884a..aa619b6762 100644
@@ -1471,6 +1471,7 @@ F: app/test/Makefile
 F: app/test/autotest*
 F: app/test/commands.c
 F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
 F: app/test/packet_burst_generator.c
 F: app/test/packet_burst_generator.h
 F: app/test/process.h
app/test/has-hugepage.sh new file +11 -0
new file mode 100755
index 0000000000..484fc5541f
@@ -0,0 +1,11 @@
+#! /bin/sh -e
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+linux_hugepages_number=/proc/sys/vm/nr_hugepages
+
+if [ -r "$linux_hugepages_number" ] ; then
+	cat /proc/sys/vm/nr_hugepages
+else
+	echo 0
+fi
app/test/meson.build +2 -6
index 351d29cb65..542408d614 100644
@@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
 
 has_hugepage = true
 if is_linux
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
+	check_hugepage = find_program('has-hugepage.sh')
+	has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
 endif
 message('hugepage availability: @0@'.format(has_hugepage))
 
Signature · 1 line
2.26.0
#1 lore raw

W dniu 09.04.2020 o 20:03, Thomas Monjalon pisze:

Quoted 34 lines

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")
---
  MAINTAINERS              |  1 +
  app/test/has-hugepage.sh | 11 +++++++++++
  app/test/meson.build     |  8 ++------
  3 files changed, 14 insertions(+), 6 deletions(-)

create mode 100755 app/test/has-hugepage.sh

MAINTAINERS +1 -0
index 4800f6884a..aa619b6762 100644
@@ -1471,6 +1471,7 @@ F: app/test/Makefile
  F: app/test/autotest*
  F: app/test/commands.c
  F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
  F: app/test/packet_burst_generator.c
  F: app/test/packet_burst_generator.h
  F: app/test/process.h
app/test/has-hugepage.sh new file +0 -0
new file mode 100755
index 0000000000..484fc5541f

app/test/has-hugepage.sh line 8

Quoted 8 lines
app/test/has-hugepage.sh new file +8 -0
@@ -0,0 +1,11 @@
+#! /bin/sh -e
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+linux_hugepages_number=/proc/sys/vm/nr_hugepages
+
+if [ -r "$linux_hugepages_number" ] ; then
+	cat /proc/sys/vm/nr_hugepages

cat $linux_hugepages_number

Quoted 22 lines
app/test/has-hugepage.sh new file +3 -0
+else
+	echo 0
+fi
app/test/meson.build +2 -6
index 351d29cb65..542408d614 100644
@@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
 
  has_hugepage = true
  if is_linux
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
+	check_hugepage = find_program('has-hugepage.sh')
+	has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
  endif
  message('hugepage availability: @0@'.format(has_hugepage))
 
Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
#2 lore raw

09/04/2020 20:10, Lukasz Wojciechowski:

Quoted 10 lines

W dniu 09.04.2020 o 20:03, Thomas Monjalon pisze:

Quoted 8 lines

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")
Quoted 7 lines

app/test/has-hugepage.sh line 8

Quoted 6 lines

---

app/test/has-hugepage.sh new file +4 -0
+linux_hugepages_number=/proc/sys/vm/nr_hugepages
+
+if [ -r "$linux_hugepages_number" ] ; then
+	cat /proc/sys/vm/nr_hugepages

cat $linux_hugepages_number

True, thank you :-)

Tested-by on v1 1/1
#3 lore raw
In reply to Thomas Monjalon

works fine

W dniu 09.04.2020 o 20:03, Thomas Monjalon pisze:

Quoted 64 lines

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")
---
  MAINTAINERS              |  1 +
  app/test/has-hugepage.sh | 11 +++++++++++
  app/test/meson.build     |  8 ++------
  3 files changed, 14 insertions(+), 6 deletions(-)

create mode 100755 app/test/has-hugepage.sh

MAINTAINERS +1 -0
index 4800f6884a..aa619b6762 100644
@@ -1471,6 +1471,7 @@ F: app/test/Makefile
  F: app/test/autotest*
  F: app/test/commands.c
  F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
  F: app/test/packet_burst_generator.c
  F: app/test/packet_burst_generator.h
  F: app/test/process.h
app/test/has-hugepage.sh new file +11 -0
new file mode 100755
index 0000000000..484fc5541f
@@ -0,0 +1,11 @@
+#! /bin/sh -e
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+linux_hugepages_number=/proc/sys/vm/nr_hugepages
+
+if [ -r "$linux_hugepages_number" ] ; then
+	cat /proc/sys/vm/nr_hugepages
+else
+	echo 0
+fi
app/test/meson.build +2 -6
index 351d29cb65..542408d614 100644
@@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
 
  has_hugepage = true
  if is_linux
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
+	check_hugepage = find_program('has-hugepage.sh')
+	has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
  endif
  message('hugepage availability: @0@'.format(has_hugepage))
 
Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
#4 lore raw

PATCH v2 1/1 test: remove meson dependency on /proc file

In reply to Thomas Monjalon

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

v2: use variable as pointed by Lukasz

---
 MAINTAINERS              |  1 +
 app/test/has-hugepage.sh | 11 +++++++++++
 app/test/meson.build     |  8 ++------
 3 files changed, 14 insertions(+), 6 deletions(-)
 create mode 100755 app/test/has-hugepage.sh
MAINTAINERS +1 -0
index 4800f6884a..aa619b6762 100644
@@ -1471,6 +1471,7 @@ F: app/test/Makefile
 F: app/test/autotest*
 F: app/test/commands.c
 F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
 F: app/test/packet_burst_generator.c
 F: app/test/packet_burst_generator.h
 F: app/test/process.h
app/test/has-hugepage.sh new file +11 -0
new file mode 100755
index 0000000000..fc6cb7efaa
@@ -0,0 +1,11 @@
+#! /bin/sh -e
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+linux_hugepages_number=/proc/sys/vm/nr_hugepages
+
+if [ -r "$linux_hugepages_number" ] ; then
+	cat $linux_hugepages_number
+else
+	echo 0
+fi
app/test/meson.build +2 -6
index 351d29cb65..542408d614 100644
@@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
 
 has_hugepage = true
 if is_linux
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
+	check_hugepage = find_program('has-hugepage.sh')
+	has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
 endif
 message('hugepage availability: @0@'.format(has_hugepage))
 
Signature · 1 line
2.26.0
Reviewed-by on v2 1/1
#5 lore raw

It's perfect now and it still works ;)

W dniu 09.04.2020 o 21:34, Thomas Monjalon pisze:

Quoted 69 lines

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

v2: use variable as pointed by Lukasz

---
  MAINTAINERS              |  1 +
  app/test/has-hugepage.sh | 11 +++++++++++
  app/test/meson.build     |  8 ++------
  3 files changed, 14 insertions(+), 6 deletions(-)

create mode 100755 app/test/has-hugepage.sh

MAINTAINERS +1 -0
index 4800f6884a..aa619b6762 100644
@@ -1471,6 +1471,7 @@ F: app/test/Makefile
  F: app/test/autotest*
  F: app/test/commands.c
  F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
  F: app/test/packet_burst_generator.c
  F: app/test/packet_burst_generator.h
  F: app/test/process.h
app/test/has-hugepage.sh new file +11 -0
new file mode 100755
index 0000000000..fc6cb7efaa
@@ -0,0 +1,11 @@
+#! /bin/sh -e
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+linux_hugepages_number=/proc/sys/vm/nr_hugepages
+
+if [ -r "$linux_hugepages_number" ] ; then
+	cat $linux_hugepages_number
+else
+	echo 0
+fi
app/test/meson.build +2 -6
index 351d29cb65..542408d614 100644
@@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
 
  has_hugepage = true
  if is_linux
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
+	check_hugepage = find_program('has-hugepage.sh')
+	has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
  endif
  message('hugepage availability: @0@'.format(has_hugepage))
 
Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
Acked-by on v2 1/1
#6 lore raw
In reply to Thomas Monjalon
Quoted 11 lines · Thomas Monjalon

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

Quoted 56 lines

v2: use variable as pointed by Lukasz

---
 MAINTAINERS              |  1 +
 app/test/has-hugepage.sh | 11 +++++++++++
 app/test/meson.build     |  8 ++------
 3 files changed, 14 insertions(+), 6 deletions(-)
 create mode 100755 app/test/has-hugepage.sh
MAINTAINERS +1 -0
index 4800f6884a..aa619b6762 100644
@@ -1471,6 +1471,7 @@ F: app/test/Makefile
 F: app/test/autotest*
 F: app/test/commands.c
 F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
 F: app/test/packet_burst_generator.c
 F: app/test/packet_burst_generator.h
 F: app/test/process.h
app/test/has-hugepage.sh new file +11 -0
new file mode 100755
index 0000000000..fc6cb7efaa
@@ -0,0 +1,11 @@
+#! /bin/sh -e
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+linux_hugepages_number=/proc/sys/vm/nr_hugepages
+
+if [ -r "$linux_hugepages_number" ] ; then
+	cat $linux_hugepages_number
+else
+	echo 0
+fi
app/test/meson.build +2 -6
index 351d29cb65..542408d614 100644
@@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
 
 has_hugepage = true
 if is_linux
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
+	check_hugepage = find_program('has-hugepage.sh')
+	has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
 endif
 message('hugepage availability: @0@'.format(has_hugepage))
Reviewed-by on v2 1/1
#7 lore raw
In reply to Thomas Monjalon
Quoted 23 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, April 10, 2020 3:34 AM
To: [email protected]
Cc: [email protected]; Lukasz Wojciechowski <[email protected]>; Aaron Conole <[email protected]>; Ruifeng Wang <[email protected]>; David Marchand <[email protected]>; Gavin Hu <[email protected]>
Subject: [PATCH v2] test: remove meson dependency on /proc file

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

Quoted 9 lines

v2: use variable as pointed by Lukasz

---
 MAINTAINERS              |  1 +
 app/test/has-hugepage.sh | 11 +++++++++++
 app/test/meson.build     |  8 ++------
 3 files changed, 14 insertions(+), 6 deletions(-)  create mode 100755

app/test/has-hugepage.sh

#8 lore raw

PATCH v3 1/1 test: remove meson dependency on /proc file

In reply to Thomas Monjalon

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

v2: use variable as pointed by Lukasz
v3: avoid TOCTOU issue as suggested by David
I'm afraid it requires to re-confirm every reviews above.

---
 MAINTAINERS              | 1 +
 app/test/has-hugepage.sh | 9 +++++++++
 app/test/meson.build     | 8 ++------
 3 files changed, 12 insertions(+), 6 deletions(-)
 create mode 100755 app/test/has-hugepage.sh
MAINTAINERS +1 -0
index 4800f6884a..aa619b6762 100644
@@ -1471,6 +1471,7 @@ F: app/test/Makefile
 F: app/test/autotest*
 F: app/test/commands.c
 F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
 F: app/test/packet_burst_generator.c
 F: app/test/packet_burst_generator.h
 F: app/test/process.h
app/test/has-hugepage.sh new file +9 -0
new file mode 100755
index 0000000000..865e66cddd
@@ -0,0 +1,9 @@
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+if [ "$(uname)" = "Linux" ] ; then
+	cat /proc/sys/vm/nr_hugepages || echo 0
+else
+	echo 0
+fi
app/test/meson.build +2 -6
index 351d29cb65..542408d614 100644
@@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
 
 has_hugepage = true
 if is_linux
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
+	check_hugepage = find_program('has-hugepage.sh')
+	has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
 endif
 message('hugepage availability: @0@'.format(has_hugepage))
 
Signature · 1 line
2.26.0
#9 lore raw
Quoted 58 lines · Thomas Monjalon

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

v2: use variable as pointed by Lukasz
v3: avoid TOCTOU issue as suggested by David
I'm afraid it requires to re-confirm every reviews above.

---
 MAINTAINERS              | 1 +
 app/test/has-hugepage.sh | 9 +++++++++
 app/test/meson.build     | 8 ++------
 3 files changed, 12 insertions(+), 6 deletions(-)
 create mode 100755 app/test/has-hugepage.sh
MAINTAINERS +1 -0
index 4800f6884a..aa619b6762 100644
@@ -1471,6 +1471,7 @@ F: app/test/Makefile
 F: app/test/autotest*
 F: app/test/commands.c
 F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
 F: app/test/packet_burst_generator.c
 F: app/test/packet_burst_generator.h
 F: app/test/process.h
app/test/has-hugepage.sh new file +9 -0
new file mode 100755
index 0000000000..865e66cddd
@@ -0,0 +1,9 @@
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+if [ "$(uname)" = "Linux" ] ; then
+	cat /proc/sys/vm/nr_hugepages || echo 0
+else
+	echo 0
+fi
app/test/meson.build +0 -0
index 351d29cb65..542408d614 100644

app/test/meson.build dpdk_test = executable('dpdk-test', · line 401

Quoted 3 lines
app/test/meson.build +0 -0
@@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
 
 has_hugepage = true
 if is_linux

Since you check for linux in the script, you can drop these two lines, and then just replace the whole branch with:

has_hugepages = run_command('has-hugepage.sh').stdout().strip() != '0'

Quoted 14 lines
app/test/meson.build +2 -6
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
+	check_hugepage = find_program('has-hugepage.sh')
+	has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
 endif
 message('hugepage availability: @0@'.format(has_hugepage))
 
Signature · 1 line
2.26.0
#10 lore raw

10/04/2020 12:42, Bruce Richardson:

Quoted 7 lines · Thomas Monjalon

app/test/meson.build dpdk_test = executable('dpdk-test', · line 401

Quoted 4 lines
app/test/meson.build +0 -0
 has_hugepage = true
 if is_linux

Since you check for linux in the script, you can drop these two lines,

The issue is for Windows.
I am not sure how we will skip shell scripts
when adding Windows support for this application.
So there are two options now:
a) remove Linux check before calling the script and ignore Windows support for now
b) keep Linux check without knowing whether it will be useful for Windows support

We vote a?

#11 lore raw
Quoted 9 lines · Thomas Monjalon

10/04/2020 12:42, Bruce Richardson:

Quoted 7 lines · Thomas Monjalon

app/test/meson.build dpdk_test = executable('dpdk-test', · line 401

Quoted 4 lines
app/test/meson.build +0 -0
 has_hugepage = true
 if is_linux

Since you check for linux in the script, you can drop these two lines,

Quoted 9 lines

The issue is for Windows.
I am not sure how we will skip shell scripts
when adding Windows support for this application.
So there are two options now:
a) remove Linux check before calling the script and ignore Windows support for now
b) keep Linux check without knowing whether it will be useful for Windows support

We vote a?

c) Write all such scripts in python, to allow them to run everywhere. :-)

Given that windows is the problem, having the is_linux check in the meson.build file makes most sense - in which case I don't think we need the check for linux in the script.

/Bruce

#12 lore raw

10/04/2020 15:25, Bruce Richardson:

Quoted 17 lines · Thomas Monjalon
Quoted 16 lines

10/04/2020 12:42, Bruce Richardson:

Quoted 7 lines · Thomas Monjalon

app/test/meson.build dpdk_test = executable('dpdk-test', · line 401

Quoted 4 lines
app/test/meson.build +0 -0
 has_hugepage = true
 if is_linux

Since you check for linux in the script, you can drop these two lines,

The issue is for Windows.
I am not sure how we will skip shell scripts
when adding Windows support for this application.
So there are two options now:
a) remove Linux check before calling the script and ignore Windows support for now
b) keep Linux check without knowing whether it will be useful for Windows support

Quoted 7 lines
Quoted 2 lines

We vote a?

c) Write all such scripts in python, to allow them to run everywhere. :-)

Given that windows is the problem, having the is_linux check in the meson.build file makes most sense - in which case I don't think we need the check for linux in the script.

Yes, let's make it simple for now.

#13 lore raw

W dniu 10.04.2020 o 16:41, Thomas Monjalon pisze:

Quoted 16 lines

10/04/2020 15:25, Bruce Richardson:

Quoted 15 lines · Thomas Monjalon
Quoted 14 lines

10/04/2020 12:42, Bruce Richardson:

Quoted 6 lines · Thomas Monjalon

app/test/meson.build dpdk_test = executable('dpdk-test', · line 401

Quoted 4 lines
app/test/meson.build +0 -0
  has_hugepage = true
  if is_linux

Since you check for linux in the script, you can drop these two lines,

The issue is for Windows.
I am not sure how we will skip shell scripts
when adding Windows support for this application.
So there are two options now:
a) remove Linux check before calling the script and ignore Windows support for now
b) keep Linux check without knowing whether it will be useful for Windows support

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

We vote a?

c) Write all such scripts in python, to allow them to run everywhere. :-)

Given that windows is the problem, having the is_linux check in the meson.build file makes most sense - in which case I don't think we need the check for linux in the script.

Yes, let's make it simple for now.

a) is ok as the current meson.build won't work in Windows environment at all.
c) would be best, but I guess it's a little bit to much for this patch and the whole build system could be adjusted to windows in separate thread.

And I agree with Bruce, that the check for Linux in script is not needed.

Quoted 1 line
Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
#14 lore raw
Quoted 27 lines · On Fri, 10 Apr 2020 22:47:44 +0200 Lukasz Wojciechowski…

W dniu 10.04.2020 o 16:41, Thomas Monjalon pisze:

Quoted 16 lines

10/04/2020 15:25, Bruce Richardson:

Quoted 15 lines · Thomas Monjalon
Quoted 14 lines

10/04/2020 12:42, Bruce Richardson:

Quoted 6 lines · Thomas Monjalon

app/test/meson.build dpdk_test = executable('dpdk-test', · line 401

Quoted 4 lines
app/test/meson.build +0 -0
  has_hugepage = true
  if is_linux  

Since you check for linux in the script, you can drop these two lines,

The issue is for Windows.
I am not sure how we will skip shell scripts
when adding Windows support for this application.
So there are two options now:
a) remove Linux check before calling the script and ignore Windows support for now
b) keep Linux check without knowing whether it will be useful for Windows support

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

We vote a?

c) Write all such scripts in python, to allow them to run everywhere. :-)

Given that windows is the problem, having the is_linux check in the meson.build file makes most sense - in which case I don't think we need the check for linux in the script.

Yes, let's make it simple for now.

Quoted 8 lines

a) is ok as the current meson.build won't work in Windows environment at all.
c) would be best, but I guess it's a little bit to much for this patch and the whole build system could be adjusted to windows in separate thread.

And I agree with Bruce, that the check for Linux in script is not needed.

Quoted 1 line

Building in a container may not give access to /proc.

#15 lore raw
In reply to Lukasz Wojciechowski

10/04/2020 22:47, Lukasz Wojciechowski:

Quoted 27 lines

W dniu 10.04.2020 o 16:41, Thomas Monjalon pisze:

Quoted 16 lines

10/04/2020 15:25, Bruce Richardson:

Quoted 15 lines · Thomas Monjalon
Quoted 14 lines

10/04/2020 12:42, Bruce Richardson:

Quoted 6 lines · Thomas Monjalon

app/test/meson.build dpdk_test = executable('dpdk-test', · line 401

Quoted 4 lines
app/test/meson.build +0 -0
  has_hugepage = true
  if is_linux

Since you check for linux in the script, you can drop these two lines,

The issue is for Windows.
I am not sure how we will skip shell scripts
when adding Windows support for this application.
So there are two options now:
a) remove Linux check before calling the script and ignore Windows support for now
b) keep Linux check without knowing whether it will be useful for Windows support

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

We vote a?

c) Write all such scripts in python, to allow them to run everywhere. :-)

Given that windows is the problem, having the is_linux check in the meson.build file makes most sense - in which case I don't think we need the check for linux in the script.

Yes, let's make it simple for now.

Quoted 6 lines

a) is ok as the current meson.build won't work in Windows environment at all.
c) would be best, but I guess it's a little bit to much for this patch and the whole build system could be adjusted to windows in separate thread.

And I agree with Bruce, that the check for Linux in script is not needed.

I decide to go with initial Bruce's suggestion:
check OS in script and remove check from meson.
The reasons:
- the script is standalone and can be extended for FreeBSD
- if Windows support is required, converting to python is better than a check in meson

#16 lore raw
In reply to Thomas Monjalon
Quoted 13 lines · Thomas Monjalon

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")
Quoted 5 lines

---

v2: use variable as pointed by Lukasz
v3: avoid TOCTOU issue as suggested by David
I'm afraid it requires to re-confirm every reviews above.

Still looks good to me.

#17 lore raw

PATCH v4 1/1 test: remove meson dependency on /proc file

In reply to Thomas Monjalon

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

v2: use variable as pointed by Lukasz
v3: avoid TOCTOU issue as suggested by David
v4: remove Linux check in meson file and skip find_program() call

---
 MAINTAINERS              |  1 +
 app/test/has-hugepage.sh |  9 +++++++++
 app/test/meson.build     | 10 +---------
 3 files changed, 11 insertions(+), 9 deletions(-)
 create mode 100755 app/test/has-hugepage.sh
MAINTAINERS +1 -0
index 144cf5d8ea..fe59f0224f 100644
@@ -1469,6 +1469,7 @@ F: app/test/Makefile
 F: app/test/autotest*
 F: app/test/commands.c
 F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
 F: app/test/packet_burst_generator.c
 F: app/test/packet_burst_generator.h
 F: app/test/process.h
app/test/has-hugepage.sh new file +9 -0
new file mode 100755
index 0000000000..865e66cddd
@@ -0,0 +1,9 @@
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+if [ "$(uname)" = "Linux" ] ; then
+	cat /proc/sys/vm/nr_hugepages || echo 0
+else
+	echo 0
+fi
app/test/meson.build +1 -9
index 777c536ae0..04b59cffa4 100644
@@ -396,15 +396,7 @@ dpdk_test = executable('dpdk-test',
 	install_rpath: driver_install_path,
 	install: true)
 
-has_hugepage = true
-if is_linux
-	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
-	if (check_hugepage.returncode() != 0 or
-	    check_hugepage.stdout().strip() == '0')
-		has_hugepage = false
-	endif
-endif
+has_hugepage = run_command('has-hugepage.sh').stdout().strip() != '0'
 message('hugepage availability: @0@'.format(has_hugepage))
 
 # some perf tests (eg: memcpy perf autotest)take very long
Signature · 1 line
2.26.0
Acked-by on v4 1/1
#18 lore raw
Quoted 18 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, April 15, 2020 2:20 PM
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Lukasz Wojciechowski <[email protected]>; Aaron Conole <[email protected]>; Ruifeng Wang <[email protected]>; David Marchand <[email protected]>; Gavin Hu <[email protected]>
Subject: [PATCH v4] test: remove meson dependency on /proc file

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Quoted 9 lines
Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

author Applied
#19 lore raw

15/04/2020 15:28, Richardson, Bruce:

Quoted 10 lines

From: Thomas Monjalon <[email protected]>

Quoted 9 lines

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")
Quoted 8 lines
Quoted 7 lines

---

Applied

#20 lore raw
In reply to Thomas Monjalon
Quoted 62 lines · Thomas Monjalon

Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat in app/test/meson.build and then adding it as a build dependency. This causes build loop if the timestamp of this file keeps changing.

It is fixed by hiding hugepage check in a shell script.

Fixes 77784ef0fba8 ("test: allow no-huge mode for fast-tests")

---

v2: use variable as pointed by Lukasz
v3: avoid TOCTOU issue as suggested by David
v4: remove Linux check in meson file and skip find_program() call

---
 MAINTAINERS              |  1 +
 app/test/has-hugepage.sh |  9 +++++++++
 app/test/meson.build     | 10 +---------
 3 files changed, 11 insertions(+), 9 deletions(-)
 create mode 100755 app/test/has-hugepage.sh
MAINTAINERS +1 -0
index 144cf5d8ea..fe59f0224f 100644
@@ -1469,6 +1469,7 @@ F: app/test/Makefile
 F: app/test/autotest*
 F: app/test/commands.c
 F: app/test/get-coremask.sh
+F: app/test/has-hugepage.sh
 F: app/test/packet_burst_generator.c
 F: app/test/packet_burst_generator.h
 F: app/test/process.h
app/test/has-hugepage.sh new file +9 -0
new file mode 100755
index 0000000000..865e66cddd
@@ -0,0 +1,9 @@
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+if [ "$(uname)" = "Linux" ] ; then
+       cat /proc/sys/vm/nr_hugepages || echo 0
+else
+       echo 0
+fi
app/test/meson.build +0 -0
index 777c536ae0..04b59cffa4 100644
@@ -396,15 +396,7 @@ dpdk_test = executable('dpdk-test',
        install_rpath: driver_install_path,
        install: true)
 

app/test/meson.build dpdk_test = executable('dpdk-test', · line 399

Quoted 10 lines
app/test/meson.build +1 -9
-has_hugepage = true
-if is_linux
-       check_hugepage = run_command('cat',
-                                    '/proc/sys/vm/nr_hugepages')
-       if (check_hugepage.returncode() != 0 or
-           check_hugepage.stdout().strip() == '0')
-               has_hugepage = false
-       endif
-endif
+has_hugepage = run_command('has-hugepage.sh').stdout().strip() != '0'

This change will force no-huge mode on FreeBSD while before we were running with hugepages.

Signature · 1 line
David Marchand
#21 lore raw

15/04/2020 15:36, David Marchand:

Quoted 21 lines · Thomas Monjalon
Quoted 20 lines
app/test/has-hugepage.sh new file +9 -0
@@ -0,0 +1,9 @@
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+if [ "$(uname)" = "Linux" ] ; then
+       cat /proc/sys/vm/nr_hugepages || echo 0
+else
+       echo 0
+fi
app/test/meson.build +0 -0
index 777c536ae0..04b59cffa4 100644
@@ -396,15 +396,7 @@ dpdk_test = executable('dpdk-test',
        install_rpath: driver_install_path,
        install: true)
 
Quoted 13 lines

app/test/meson.build dpdk_test = executable('dpdk-test', · line 399

Quoted 10 lines
app/test/meson.build +1 -9
-has_hugepage = true
-if is_linux
-       check_hugepage = run_command('cat',
-                                    '/proc/sys/vm/nr_hugepages')
-       if (check_hugepage.returncode() != 0 or
-           check_hugepage.stdout().strip() == '0')
-               has_hugepage = false
-       endif
-endif
+has_hugepage = run_command('has-hugepage.sh').stdout().strip() != '0'

This change will force no-huge mode on FreeBSD while before we were running with hugepages.

Indeed

I propose to squash this change to maintain the old behaviour:

+elif [ "$(uname)" = "FreeBSD" ] ; then
+ echo 1 # assume FreeBSD always has hugepages

#22 lore raw

Review

Quoted 10 lines · Thomas Monjalon
Quoted 2 lines

This change will force no-huge mode on FreeBSD while before we were running with hugepages.

Indeed

I propose to squash this change to maintain the old behaviour:

(quoted diff) +2 -0
+elif [ "$(uname)" = "FreeBSD" ] ; then
+       echo 1 # assume FreeBSD always has hugepages

Ok for me.

Signature · 1 line
David Marchand
#23 lore raw

15/04/2020 15:49, David Marchand:

Quoted 6 lines · Thomas Monjalon
Quoted 5 lines
Quoted 2 lines

This change will force no-huge mode on FreeBSD while before we were running with hugepages.

Indeed

Quoted 7 lines

Review

Quoted 5 lines

I propose to squash this change to maintain the old behaviour:

(quoted diff) +2 -0
+elif [ "$(uname)" = "FreeBSD" ] ; then
+       echo 1 # assume FreeBSD always has hugepages

Ok for me.

OK, squashed:

	http://git.dpdk.org/dpdk/commit/?id=5f1a4a8a125672