File tree Expand file tree Collapse file tree 4 files changed +14
-66
lines changed Expand file tree Collapse file tree 4 files changed +14
-66
lines changed Original file line number Diff line number Diff line change 5757 cabal sdist -z -o .
5858 cabal get unix-*.tar.gz
5959 cd unix-*/
60- cabal test all --test-show-details=direct
60+ cabal test -f+non-portable-tests all --test-show-details=direct
6161 - name : Haddock
6262 run : |
6363 cabal haddock --disable-documentation
8585 cabal update
8686 autoreconf --version
8787 autoreconf -i
88- cabal test all --test-show-details=direct
88+ cabal test -f+non-portable-tests all --test-show-details=direct
8989
9090 fedora37 :
9191 runs-on : ubuntu-latest
@@ -110,7 +110,7 @@ jobs:
110110 autoreconf --version
111111 autoreconf -i
112112 # test filepath >= 1.5
113- cabal test --constraint='filepath >= 1.5.0.0' all --test-show-details=direct
113+ cabal test -f+non-portable-tests - -constraint='filepath >= 1.5.0.0' all --test-show-details=direct
114114
115115 i386 :
116116 runs-on : ubuntu-latest
@@ -182,5 +182,5 @@ jobs:
182182 cabal sdist -z -o .
183183 cabal get unix-*.tar.gz
184184 cd unix-*/
185- cabal test all --test-show-details=direct
185+ cabal test -f+non-portable-tests all --test-show-details=direct
186186
Original file line number Diff line number Diff line change @@ -65,66 +65,6 @@ FP_CHECK_CONST([DT_WHT], [
6565#include <dirent.h>
6666#endif] , [ -9] )
6767
68- AC_LANG ( C )
69- AC_MSG_CHECKING ( whether kernel returns a useful d_type )
70- AC_RUN_IFELSE (
71- [ AC_LANG_SOURCE ( [ [
72- #if HAVE_STRUCT_DIRENT_D_TYPE
73- #include <dirent.h>
74- #include <errno.h>
75- #include <stdio.h>
76- #include <stdlib.h>
77- #include <string.h>
78- #include <sys/types.h>
79-
80- void check_error(const char *msg) {
81- if (errno) {
82- perror(msg);
83- exit(1);
84- }
85- }
86-
87- int main() {
88- DIR *dir = opendir(".");
89- check_error("opendir");
90-
91- struct dirent *de = NULL;
92-
93- do {
94- de = readdir(dir);
95- check_error("readdir");
96- } while (de && strcmp(de->d_name, ".") != 0);
97- // We found the . dir or encountered end of dir stream
98-
99- int status = 0;
100-
101- if (!de) {
102- status = 1;
103- } else if (de->d_type == DT_DIR) {
104- } else if (de->d_type == DT_UNKNOWN) {
105- // Signal that we should skip test for non-zero d_type
106- status = 2;
107- } else {
108- status = 1;
109- }
110-
111- closedir(dir);
112- check_error("closedir");
113-
114- exit(status);
115- }
116- #else
117- int main() { exit(2); }
118- #endif
119- ] ] ) ] ,
120- [ AC_MSG_RESULT ( yes ) ] ,
121- [ if test $? -eq 1 ; then
122- AC_MSG_FAILURE ( Unexpected failure when testing for kernels d_type )
123- else
124- AC_MSG_RESULT ( no ( skipping DirEnt test ))
125- AC_DEFINE ( [ NO_DTIR_TEST] , [ 1] , [ Define to 1 if we want to stkip DirEnt test.] )
126- fi] )
127-
12868AC_CHECK_FUNCS ( [ getgrgid_r getgrnam_r getpwnam_r getpwuid_r getpwnam getpwuid] )
12969AC_CHECK_FUNCS ( [ getpwent getgrent] )
13070AC_CHECK_FUNCS ( [ lchown setenv sysconf unsetenv clearenv] )
Original file line number Diff line number Diff line change 33#include "HsUnixConfig.h"
44
55module Main (main ) where
6- #if defined(NO_DTIR_TEST )
6+ #if ! defined(HAVE_STRUCT_DIRENT_D_TYPE )
77main :: IO ()
88main = do
9- putStrLn " Skipping DirEnt test, since kernel seems to always return DT_UNKNOWN "
9+ putStrLn " Skipping DirEnt test, since the system doesn't support d_type "
1010#else
1111
1212import Control.Exception (bracket , finally )
Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ flag os-string
5353 default : False
5454 manual : False
5555
56+ flag non-portable-tests
57+ description : Run tests that may not be portable across all systems, but are guaranteed to succeed in our own CI
58+ default : False
59+ manual : True
60+
5661source-repository head
5762 type : git
5863 location : https://github.com/haskell/unix.git
@@ -390,4 +395,7 @@ test-suite DirEnt
390395 default-language : Haskell2010
391396 build-depends : base, unix
392397 ghc-options : -Wall
398+ if !flag(non-portable-tests)
399+ build-depends : unbuildable< 0
400+ buildable : False
393401
You can’t perform that action at this time.
0 commit comments