Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37722043
en ru br
ALT Linux repositórios
S:3.8.1-alt2

Group :: Sistema/Bibliotecas
RPM: gnutls30

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: tests-Don-t-use-lscpu.patch
Download


diff --git a/tests/scripts/common.sh b/tests/scripts/common.sh
index bac8102ff..9b2cf3483 100644
--- a/tests/scripts/common.sh
+++ b/tests/scripts/common.sh
@@ -124,10 +124,20 @@ fail() {
    exit 1
 }
 
+test_arch__()
+{
+	arch | grep -qs ^"$1"
+}
+
+test_cpu_flags__()
+{
+	[ -r /proc/cpuinfo ] || return 1
+	grep -qs "^flags[[:blank:]]*:.*$1" /proc/cpuinfo
+}
+
 exit_if_non_x86()
 {
-	if (lscpu --version) >/dev/null 2>&1 && \
-	    ! lscpu 2>/dev/null | grep 'Architecture:[	 ]*x86' >/dev/null; then
+	if ! test_arch__ x86; then
 		echo "non-x86 CPU detected"
 		exit
 	fi
@@ -135,8 +145,7 @@ exit_if_non_x86()
 
 exit_if_non_padlock()
 {
-	if (lscpu --version) >/dev/null 2>&1 && \
-	   ! lscpu 2>/dev/null | grep 'Flags:[	 ]*phe' >/dev/null; then
+	if ! test_cpu_flags__ phe; then
 		echo "non-Via padlock CPU detected"
 		exit
 	fi
diff --git a/tests/slow/test-ciphers-common.sh b/tests/slow/test-ciphers-common.sh
index 7a7bf0c36..7ea9f1ca6 100644
--- a/tests/slow/test-ciphers-common.sh
+++ b/tests/slow/test-ciphers-common.sh
@@ -77,8 +77,7 @@ if test $ret != 0; then
 fi
 
 echo SHANI
-if (lscpu --version) >/dev/null 2>&1 && \
-   lscpu 2>/dev/null | grep 'Flags:[	]*sha_ni' >/dev/null; then
+if test_cpu_flags__ sha_ni; then
 	GNUTLS_CPUID_OVERRIDE=0x20 ${PROG}
 	ret=$?
 	if test $ret != 0; then
diff --git a/tests/slow/test-hash-large.sh b/tests/slow/test-hash-large.sh
index 7a052bddc..e57578e7b 100755
--- a/tests/slow/test-hash-large.sh
+++ b/tests/slow/test-hash-large.sh
@@ -45,14 +45,12 @@ run_test() {
 #"": default optimizations
 
 FLAGS=""
-if (lscpu --version) >/dev/null 2>&1; then
-        if lscpu 2>/dev/null | grep 'Flags:[	]*ssse3' >/dev/null; then
-                FLAGS="$FLAGS 0x4"
-        fi
+if test_cpu_flags__ ssse3; then
+		FLAGS="$FLAGS 0x4"
+fi
 
-        if lscpu 2>/dev/null | grep 'Flags:[	]*sha_ni' >/dev/null; then
-                FLAGS="$FLAGS 0x20"
-        fi
+if test_cpu_flags__ sha_ni; then
+		FLAGS="$FLAGS 0x20"
 fi
 
 WAITPID=""
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009