diff mbox

Recursively copy files before config test

Message ID 1460031085-30498-1-git-send-email-msuraev@sysmocom.de
State Not Applicable
Headers show

Commit Message

Max April 7, 2016, 12:11 p.m. UTC
From: Max <msuraev@sysmocom.de>

Copy all potentially necessary files (like includable configs) before
running config test.
---
 osmopy/osmotestconfig.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Holger Freyther April 13, 2016, 12:38 a.m. UTC | #1
> On 07 Apr 2016, at 08:11, msuraev@sysmocom.de wrote:
> 
> From: Max <msuraev@sysmocom.de>
> 
> Copy all potentially necessary files (like includable configs) before
> running config test.

http://jenkins.osmocom.org/jenkins/job/osmo-pcu/731/label=linux_i386_debian_squeeze,sysmobts=no,sysmodsp=no/console

Traceback (most recent call last):
  File "/usr/local/bin/osmotestconfig.py", line 212, in <module>
    confpath=confpath, verbose=args.verbose))
  File "/usr/local/bin/osmotestconfig.py", line 169, in test_all_apps
    errors |= test_config(app, config, tmpdir, verbose)
  File "/usr/local/bin/osmotestconfig.py", line 34, in test_config
    newconfig = copy_config(tmpdir, config)
  File "/usr/local/bin/osmotestconfig.py", line 87, in copy_config
    dir=dirname, prefix=prefix, delete=False)
  File "/usr/lib/python2.6/tempfile.py", line 444, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python2.6/tempfile.py", line 228, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: 'writtenconfig/osmo-pcu.cfgayzRgv'

is that related to your patch?
Max April 13, 2016, 8:10 a.m. UTC | #2
Not directly - the error is not triggered from the code I've added. But
it could be that my code somehow changed/not changed metadata in some
corner case. I'm unable to reproduce this locally - is there way to get
file details from jenkins? Permission, owner, xattr etc from both target
and destination of the copy and upper folders?

On 04/13/2016 02:38 AM, Holger Freyther wrote:
>> On 07 Apr 2016, at 08:11, msuraev@sysmocom.de wrote:
>>
>> From: Max <msuraev@sysmocom.de>
>>
>> Copy all potentially necessary files (like includable configs) before
>> running config test.
> http://jenkins.osmocom.org/jenkins/job/osmo-pcu/731/label=linux_i386_debian_squeeze,sysmobts=no,sysmodsp=no/console
>
> Traceback (most recent call last):
>   File "/usr/local/bin/osmotestconfig.py", line 212, in <module>
>     confpath=confpath, verbose=args.verbose))
>   File "/usr/local/bin/osmotestconfig.py", line 169, in test_all_apps
>     errors |= test_config(app, config, tmpdir, verbose)
>   File "/usr/local/bin/osmotestconfig.py", line 34, in test_config
>     newconfig = copy_config(tmpdir, config)
>   File "/usr/local/bin/osmotestconfig.py", line 87, in copy_config
>     dir=dirname, prefix=prefix, delete=False)
>   File "/usr/lib/python2.6/tempfile.py", line 444, in NamedTemporaryFile
>     (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
>   File "/usr/lib/python2.6/tempfile.py", line 228, in _mkstemp_inner
>     fd = _os.open(file, flags, 0600)
> OSError: [Errno 13] Permission denied: 'writtenconfig/osmo-pcu.cfgayzRgv'
>
> is that related to your patch?
>
>
>
Holger Freyther April 13, 2016, 10:49 a.m. UTC | #3
> On 13 Apr 2016, at 04:10, Max <msuraev@sysmocom.de> wrote:
> 

Hi,

> Not directly - the error is not triggered from the code I've added. But
> it could be that my code somehow changed/not changed metadata in some
> corner case. I'm unable to reproduce this locally - is there way to get
> file details from jenkins? Permission, owner, xattr etc from both target
> and destination of the copy and upper folders?

well, the responsibility is with you. Have you looked at the console output and when it happens?

It happens with "make: *** [distcheck] Error 1". Which means the source directory will be checked out read-only, which means the files you copy are read-only. I would be surprised if

DISTCHECK_CONFIGURE_FLAGS=--enable-sysmocom-bts=no --enable-sysmocom-dsp=no --enable-vty-tests AM_DISTCHECK_CONFIGURE_FLAGS=--enable-sysmocom-bts=no --enable-sysmocom-dsp=no --enable-vty-tests PKG_CONFIG_PATH=/home/builder/source/workspace/osmo-pcu/label/linux_i386_debian_squeeze/sysmobts/no/sysmodsp/no/deps/install/lib/pkgconfig LD_LIBRARY_PATH=/home/builder/source/workspace/osmo-pcu/label/linux_i386_debian_squeeze/sysmobts/no/sysmodsp/no/deps/install/lib make distcheck

doesn't reproduce the issue for you.

holger
Max April 13, 2016, 12:37 p.m. UTC | #4
The quickest solution would be to remove "--enable-vty-tests" from
distcheck variables but I do not see how they are populated?
I've reproduced it with osmo-pcu but not with openbsc - I wonder what's
the difference between how distcheck is run for both.

On 04/13/2016 12:49 PM, Holger Freyther wrote:
>> On 13 Apr 2016, at 04:10, Max <msuraev@sysmocom.de> wrote:
>>
> Hi,
>
>> Not directly - the error is not triggered from the code I've added. But
>> it could be that my code somehow changed/not changed metadata in some
>> corner case. I'm unable to reproduce this locally - is there way to get
>> file details from jenkins? Permission, owner, xattr etc from both target
>> and destination of the copy and upper folders?
> well, the responsibility is with you. Have you looked at the console output and when it happens?
>
> It happens with "make: *** [distcheck] Error 1". Which means the source directory will be checked out read-only, which means the files you copy are read-only. I would be surprised if
>
> DISTCHECK_CONFIGURE_FLAGS=--enable-sysmocom-bts=no --enable-sysmocom-dsp=no --enable-vty-tests AM_DISTCHECK_CONFIGURE_FLAGS=--enable-sysmocom-bts=no --enable-sysmocom-dsp=no --enable-vty-tests PKG_CONFIG_PATH=/home/builder/source/workspace/osmo-pcu/label/linux_i386_debian_squeeze/sysmobts/no/sysmodsp/no/deps/install/lib/pkgconfig LD_LIBRARY_PATH=/home/builder/source/workspace/osmo-pcu/label/linux_i386_debian_squeeze/sysmobts/no/sysmodsp/no/deps/install/lib make distcheck
>
> doesn't reproduce the issue for you.
>
> holger
diff mbox

Patch

diff --git a/osmopy/osmotestconfig.py b/osmopy/osmotestconfig.py
index b020d86..5c981d1 100644
--- a/osmopy/osmotestconfig.py
+++ b/osmopy/osmotestconfig.py
@@ -17,7 +17,7 @@ 
 import os
 import os.path
 import time
-import sys
+import sys, shutil
 import tempfile
 
 import osmopy.obscvty as obscvty
@@ -72,15 +72,15 @@  def test_config_atest(app_desc, config, run_test, verbose=True):
 
     return ret
 
-
 def copy_config(dirname, config):
+    shutil.rmtree(dirname, True)
+    ign = shutil.ignore_patterns('*.cfg')
+    shutil.copytree(os.path.dirname(config), dirname, ignore=ign)
+
     try:
         os.stat(dirname)
     except OSError:
         os.mkdir(dirname)
-    else:
-        remove_tmpdir(dirname)
-        os.mkdir(dirname)
 
     prefix = os.path.basename(config)
     tmpfile = tempfile.NamedTemporaryFile(