From 70d8ef786ac89cfa07a3e7d55df4beb6181a657e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 4 Mar 2015 09:49:31 +0100 Subject: [PATCH] tests: Gracefully handle ENOSYS return for 'setaffinity'. Fixes . Reported by John Paul Adrian Glaubitz . * test-suite/tests/posix.test ("affinity")["setaffinity"]: Wrap in 'catch' and throw 'unresolved upon ENOSYS. --- test-suite/tests/posix.test | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test index 9a0e489b4..f57001a24 100644 --- a/test-suite/tests/posix.test +++ b/test-suite/tests/posix.test @@ -1,6 +1,7 @@ ;;;; posix.test --- Test suite for Guile POSIX functions. -*- scheme -*- ;;;; -;;;; Copyright 2003, 2004, 2006, 2007, 2010, 2012 Free Software Foundation, Inc. +;;;; Copyright 2003, 2004, 2006, 2007, 2010, 2012, +;;;; 2015 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -195,9 +196,18 @@ (pass-if "setaffinity" (if (and (defined? 'setaffinity) (defined? 'getaffinity)) - (let ((mask (getaffinity (getpid)))) - (setaffinity (getpid) mask) - (equal? mask (getaffinity (getpid)))) + (catch 'system-error + (lambda () + (let ((mask (getaffinity (getpid)))) + (setaffinity (getpid) mask) + (equal? mask (getaffinity (getpid))))) + (lambda args + ;; On some platforms such as sh4-linux-gnu, 'setaffinity' + ;; returns ENOSYS. + (let ((errno (system-error-errno args))) + (if (= errno ENOSYS) + (throw 'unresolved) + (apply throw args))))) (throw 'unresolved)))) ;;