From c524a62d10bc3045b2d1d12158eea4de0e2e01ea Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 29 Mar 2019 19:47:20 -0700 Subject: [PATCH 1/6] Add strace hack for tarfile test --- .azure-pipelines/posix-steps.yml | 5 +++++ Lib/test/test_tarfile.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.azure-pipelines/posix-steps.yml b/.azure-pipelines/posix-steps.yml index 2affb50dc10e59..16cad71d0dc326 100644 --- a/.azure-pipelines/posix-steps.yml +++ b/.azure-pipelines/posix-steps.yml @@ -66,6 +66,11 @@ steps: displayName: 'Run patchcheck.py' condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) +- task: PublishBuildArtifacts@1 + inputs: + pathToPublish: $(build.binariesDirectory)/tarfile + artifactName: tarfile + - task: PublishTestResults@2 displayName: 'Publish Test Results' diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 7e32cbccd6c56d..e5fa7d870b15c5 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1412,6 +1412,11 @@ def test_file_mode(self): if os.path.exists(tmpname): support.unlink(tmpname) + import os, time + pid = os.getpid() + os.system("strace -p %d 2>$BUILD_BINARIESDIRECTORY/tarfile/strace.out &" % pid) + time.sleep(2) # get strace heaps of time to start + original_umask = os.umask(0o022) try: tar = tarfile.open(tmpname, self.mode) From 1f6cdc0701340e36ecada04a4af7042334a2d57e Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 29 Mar 2019 20:01:10 -0700 Subject: [PATCH 2/6] Fixes silly bugs, suppresses other CI --- .azure-pipelines/pr.yml | 4 ++-- .github/appveyor.yml | 10 +++++----- .travis.yml | 2 +- Lib/test/test_tarfile.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.azure-pipelines/pr.yml b/.azure-pipelines/pr.yml index 0bd7921bcbefcc..38f08d419216cf 100644 --- a/.azure-pipelines/pr.yml +++ b/.azure-pipelines/pr.yml @@ -33,7 +33,7 @@ jobs: - job: macOS_PR_Tests displayName: macOS PR Tests dependsOn: Prebuild - condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true')) + condition: false # and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true')) variables: testRunTitle: '$(system.pullRequest.TargetBranch)-macos' @@ -128,7 +128,7 @@ jobs: - job: Windows_PR_Tests displayName: Windows PR Tests dependsOn: Prebuild - condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true')) + condition: false #and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true')) pool: vmImage: vs2017-win2016 diff --git a/.github/appveyor.yml b/.github/appveyor.yml index e8012f69ee5b2e..f3c2da90f09164 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -27,11 +27,11 @@ before_build: } -build_script: - - cmd: PCbuild\build.bat -e -p x64 - - cmd: PCbuild\amd64\python.exe -m test.pythoninfo -test_script: - - cmd: PCbuild\rt.bat -x64 -q -uall -u-cpu -u-largefile -rwW --slowest --timeout=1200 --fail-env-changed -j0 +#build_script: +# - cmd: PCbuild\build.bat -e -p x64 +# - cmd: PCbuild\amd64\python.exe -m test.pythoninfo +#test_script: +# - cmd: PCbuild\rt.bat -x64 -q -uall -u-cpu -u-largefile -rwW --slowest --timeout=1200 --fail-env-changed -j0 environment: HOST_PYTHON: C:\Python36\python.exe image: diff --git a/.travis.yml b/.travis.yml index 6d57ebb1d2fb96..5a73833993dc84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -173,7 +173,7 @@ script: if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then XVFB_RUN=xvfb-run; fi - $XVFB_RUN make buildbottest TESTOPTS="-j4 -uall,-cpu" + #$XVFB_RUN make buildbottest TESTOPTS="-j4 -uall,-cpu" notifications: email: false irc: diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index e5fa7d870b15c5..667b6b5dba9e5d 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1409,10 +1409,10 @@ def test_stream_padding(self): def test_file_mode(self): # Test for issue #8464: Create files with correct # permissions. + import os, time if os.path.exists(tmpname): support.unlink(tmpname) - import os, time pid = os.getpid() os.system("strace -p %d 2>$BUILD_BINARIESDIRECTORY/tarfile/strace.out &" % pid) time.sleep(2) # get strace heaps of time to start From 7a0f0e358a81aefe12b367e98dfffaecf89c4cf8 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 29 Mar 2019 20:23:06 -0700 Subject: [PATCH 3/6] Actually upload strace file Leave other CIs alone --- .azure-pipelines/posix-steps.yml | 1 + .github/appveyor.yml | 10 +++++----- .travis.yml | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/posix-steps.yml b/.azure-pipelines/posix-steps.yml index 16cad71d0dc326..3ce44ead0ef158 100644 --- a/.azure-pipelines/posix-steps.yml +++ b/.azure-pipelines/posix-steps.yml @@ -70,6 +70,7 @@ steps: inputs: pathToPublish: $(build.binariesDirectory)/tarfile artifactName: tarfile + condition: succeededOrFailed() - task: PublishTestResults@2 diff --git a/.github/appveyor.yml b/.github/appveyor.yml index f3c2da90f09164..e8012f69ee5b2e 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -27,11 +27,11 @@ before_build: } -#build_script: -# - cmd: PCbuild\build.bat -e -p x64 -# - cmd: PCbuild\amd64\python.exe -m test.pythoninfo -#test_script: -# - cmd: PCbuild\rt.bat -x64 -q -uall -u-cpu -u-largefile -rwW --slowest --timeout=1200 --fail-env-changed -j0 +build_script: + - cmd: PCbuild\build.bat -e -p x64 + - cmd: PCbuild\amd64\python.exe -m test.pythoninfo +test_script: + - cmd: PCbuild\rt.bat -x64 -q -uall -u-cpu -u-largefile -rwW --slowest --timeout=1200 --fail-env-changed -j0 environment: HOST_PYTHON: C:\Python36\python.exe image: diff --git a/.travis.yml b/.travis.yml index 5a73833993dc84..6d57ebb1d2fb96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -173,7 +173,7 @@ script: if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then XVFB_RUN=xvfb-run; fi - #$XVFB_RUN make buildbottest TESTOPTS="-j4 -uall,-cpu" + $XVFB_RUN make buildbottest TESTOPTS="-j4 -uall,-cpu" notifications: email: false irc: From a29e22cb3094645e44cb6e712a779cd9850d1353 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 29 Mar 2019 20:52:21 -0700 Subject: [PATCH 4/6] Add mkdir call --- Lib/test/test_tarfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 667b6b5dba9e5d..6111443f038dd4 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1414,6 +1414,7 @@ def test_file_mode(self): support.unlink(tmpname) pid = os.getpid() + os.mkdir(os.getenv("BUILD_BINARIESDIRECTORY") + "/tarfile") os.system("strace -p %d 2>$BUILD_BINARIESDIRECTORY/tarfile/strace.out &" % pid) time.sleep(2) # get strace heaps of time to start From 04edcb15626ac2d60dba6455b663a7a7c45d1a75 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 30 Mar 2019 08:15:05 -0700 Subject: [PATCH 5/6] Sequential tests, sudo strace, kill after tarfile --- .azure-pipelines/posix-steps.yml | 2 +- Lib/test/test_tarfile.py | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.azure-pipelines/posix-steps.yml b/.azure-pipelines/posix-steps.yml index 3ce44ead0ef158..45d930ecc62dc6 100644 --- a/.azure-pipelines/posix-steps.yml +++ b/.azure-pipelines/posix-steps.yml @@ -53,7 +53,7 @@ steps: - script: make pythoninfo displayName: 'Display build info' - - script: $COMMAND buildbottest TESTOPTS="-j4 -uall,-cpu --junit-xml=$(build.binariesDirectory)/test-results.xml" + - script: $COMMAND buildbottest TESTOPTS="-uall,-cpu --junit-xml=$(build.binariesDirectory)/test-results.xml" displayName: 'Tests' env: ${{ if eq(parameters.xvfb, 'true') }}: diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 6111443f038dd4..3acf309b5d896b 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1409,23 +1409,27 @@ def test_stream_padding(self): def test_file_mode(self): # Test for issue #8464: Create files with correct # permissions. - import os, time + import os, time, signal if os.path.exists(tmpname): support.unlink(tmpname) pid = os.getpid() os.mkdir(os.getenv("BUILD_BINARIESDIRECTORY") + "/tarfile") - os.system("strace -p %d 2>$BUILD_BINARIESDIRECTORY/tarfile/strace.out &" % pid) + os.system("sudo strace -p %d 2>$BUILD_BINARIESDIRECTORY/tarfile/strace.out &" % pid) time.sleep(2) # get strace heaps of time to start - original_umask = os.umask(0o022) try: - tar = tarfile.open(tmpname, self.mode) - tar.close() - mode = os.stat(tmpname).st_mode & 0o777 - self.assertEqual(mode, 0o644, "wrong file permissions") + original_umask = os.umask(0o022) + try: + tar = tarfile.open(tmpname, self.mode) + tar.close() + mode = os.stat(tmpname).st_mode & 0o777 + self.assertEqual(mode, 0o644, "wrong file permissions") + finally: + os.umask(original_umask) finally: - os.umask(original_umask) + time.sleep(5) + os.kill(os.getpid(), signal.SIGKILL) class GzipStreamWriteTest(GzipTest, StreamWriteTest): pass From 0759cd5339ca3e62b64d10e412bcb78703d03e2c Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 30 Mar 2019 14:30:18 -0700 Subject: [PATCH 6/6] Try resetting ACLs and start strace sooner --- .azure-pipelines/posix-steps.yml | 9 +++++++++ Lib/test/test_tarfile.py | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/posix-steps.yml b/.azure-pipelines/posix-steps.yml index 45d930ecc62dc6..7c50ca975b7ae1 100644 --- a/.azure-pipelines/posix-steps.yml +++ b/.azure-pipelines/posix-steps.yml @@ -48,6 +48,15 @@ steps: - script: source ./venv/bin/activate && bash <(curl -s https://codecov.io/bash) displayName: 'Publish code coverage results' +- script: | + DEVICE=$(df . | tail -n +2 | awk '{print $1}') + sudo tune2fs -l $DEVICE | grep -w "Default mount options" + mount | grep -w $DEVICE + getfacl . + displayName: Check ACLs + +- script: setfacl -b . + displayName: Clear ACLs - ${{ if ne(parameters.coverage, 'true') }}: - script: make pythoninfo diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 3acf309b5d896b..191dacb082b6f4 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1410,14 +1410,14 @@ def test_file_mode(self): # Test for issue #8464: Create files with correct # permissions. import os, time, signal - if os.path.exists(tmpname): - support.unlink(tmpname) - pid = os.getpid() os.mkdir(os.getenv("BUILD_BINARIESDIRECTORY") + "/tarfile") os.system("sudo strace -p %d 2>$BUILD_BINARIESDIRECTORY/tarfile/strace.out &" % pid) time.sleep(2) # get strace heaps of time to start + if os.path.exists(tmpname): + support.unlink(tmpname) + try: original_umask = os.umask(0o022) try: