[PATCH] D53832: Make instrprof-set-dir-mode test tolerant of group ID

Matt Davis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 20:25:08 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL357449: [compiler-rt][test] Make instrprof-set-dir-mode test tolerant of group ID (authored by mattd, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D53832?vs=171565&id=193227#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53832/new/

https://reviews.llvm.org/D53832

Files:
  compiler-rt/trunk/test/profile/instrprof-set-dir-mode.c


Index: compiler-rt/trunk/test/profile/instrprof-set-dir-mode.c
===================================================================
--- compiler-rt/trunk/test/profile/instrprof-set-dir-mode.c
+++ compiler-rt/trunk/test/profile/instrprof-set-dir-mode.c
@@ -25,11 +25,15 @@
   if (Mode != __llvm_profile_get_dir_mode())
     Ret = -1;
   else {
+    // From 'man mkdir':
+    // "If the parent directory has the set-group-ID bit set, then so will the
+    // newly created directory."  So we mask off S_ISGID below; this test cannot
+    // control its parent directory.
     const unsigned Expected = ~umask(0) & Mode;
     struct stat DirSt;
     if (stat(Dir, &DirSt) == -1)
       Ret = -1;
-    else if (DirSt.st_mode != Expected) {
+    else if ((DirSt.st_mode & ~S_ISGID) != Expected) {
       printf("Modes do not match: Expected %o but found %o (%s)\n", Expected,
              DirSt.st_mode, Dir);
       Ret = -1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53832.193227.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190402/3cba598e/attachment.bin>


More information about the llvm-commits mailing list