Merge lp:~mandel/ubuntuone-client/skip-lint into lp:ubuntuone-client

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 1183
Merged at revision: 1181
Proposed branch: lp:~mandel/ubuntuone-client/skip-lint
Merge into: lp:ubuntuone-client
Diff against target: 130 lines (+66/-17)
1 file modified
run-tests.bat (+66/-17)
To merge this branch: bzr merge lp:~mandel/ubuntuone-client/skip-lint
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+89232@code.launchpad.net

Commit message

Adds the possibility to skip the lint checks on windows when passing the /skip-lint parameter to run-tests.bat.

Description of the change

Adds the possibility to skip the lint checks on windows when passing the /skip-lint parameter to run-tests.bat. The script now works as follows:

run-tests.bat /skip-lint trial_params

The above will skip the lint checks and will forward the trial parameters to u1trial, ans example of this is:

run-tests.bat /skip-lint -t test_get_homedir

if /skip-lint is not provided the scripts works as it used to

run-tests.bat -t test_get_homedir

To post a comment you must log in.
1183. By Manuel de la Peña

Made the batch more readable.

Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run-tests.bat'
2--- run-tests.bat 2012-01-12 13:06:51 +0000
3+++ run-tests.bat 2012-01-19 13:29:22 +0000
4@@ -1,6 +1,4 @@
5-:: Author: Manuel de la Pena <manuel@canonical.com>
6-::
7-:: Copyright 2010 Canonical Ltd.
8+:: Copyright 2010-12 Canonical Ltd.
9 ::
10 :: This program is free software: you can redistribute it and/or modify it
11 :: under the terms of the GNU General Public License version 3, as published
12@@ -13,53 +11,104 @@
13 ::
14 :: You should have received a copy of the GNU General Public License along
15 :: with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17 @ECHO off
18+
19 :: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
20 :: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.
21+SET REGQUERY27="REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve"
22+SET REGQUERY2732="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve"
23+SET REGQUERY26="REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve"
24+SET REGQUERY2632="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve"
25 SET PYTHONEXEPATH=""
26+
27 :: This is very annoying; FOR /F will work differently depending on the output
28 :: of reg which is not consistent between OS versions (XP, 7). We must choose
29 :: the tokens according to OS version.
30 SET PYTHONPATHTOKENS=3
31 VER | FIND "XP" > nul
32-IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4
33+IF %ERRORLEVEL% == 0 (
34+ SET PYTHONPATHTOKENS=4)
35+
36 ECHO Checking if python 2.7 is in the system
37+
38 :: Look for python 2.7
39-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONEXEPATH=%%A
40-IF NOT %PYTHONEXEPATH% == "" GOTO :PYTHONPRESENT
41+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY27%') DO @SET PYTHONEXEPATH=%%A
42+
43+IF NOT %PYTHONEXEPATH% == "" (
44+ GOTO :PYTHONPRESENT)
45+
46 ECHO Checking if python 2.6 is in the system
47 :: we do not have python 2.7 in the system, try to find 2.6
48-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONEXEPATH=%%A
49-IF NOT %PYTHONEXEPATH% == "" GOTO :PYTHONPRESENT
50+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY26%') DO @SET PYTHONEXEPATH=%%A
51+
52+IF NOT %PYTHONEXEPATH% == "" (
53+ GOTO :PYTHONPRESENT)
54
55 :: we do not have python (2.6 or 2.7) this could hapen in the case that the
56 :: user installed the 32version in a 64 machine, let check if the software was installed in the wow key
57
58 :: Look for python 2.7 in WoW64
59 ECHO Checking if python 2.7 32 is in the system
60-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONEXEPATH=%%A
61-IF NOT %PYTHONEXEPATH% == "" GOTO :PYTHONPRESENT
62+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2732%') DO @SET PYTHONEXEPATH=%%A
63+
64+IF NOT %PYTHONEXEPATH% == "" (
65+ GOTO :PYTHONPRESENT)
66+
67 ECHO Checking if python 2.6 32 is in the system
68 :: we do not have python 2.7 in the system, try to find 2.6
69-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONEXEPATH=%%A
70-IF NOT %PYTHONEXEPATH% == "" GOTO :PYTHONPRESENT
71+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2632%') DO @SET PYTHONEXEPATH=%%A
72+
73+IF NOT %PYTHONEXEPATH% == "" (
74+ GOTO :PYTHONPRESENT)
75
76 ECHO Please ensure you have python installed
77 GOTO :END
78
79
80 :PYTHONPRESENT
81+
82+:: throw the first parameter away if is /skip-lint,
83+:: the way we do this is to ensure that /skip-lint
84+:: is the first parameter and copy all the rest in a loop
85+:: the main reason for that is that %* is not affected
86+:: by SHIFT, that is, it allways have all passed parameters
87+
88+SET PARAMS=%*
89+SET SKIPLINT=0
90+IF "%1" == "/skip-lint" (
91+ SET SKIPLINT=1
92+ GOTO :CLEANPARAMS
93+)ELSE (
94+ GOTO :CONTINUEBATCH)
95+:CLEANPARAMS
96+
97+SHIFT
98+SET PARAMS=%1
99+:GETREST
100+SHIFT
101+if [%1]==[] (
102+ GOTO CONTINUEBATCH)
103+SET PARAMS=%PARAMS% %1
104+GOTO GETREST
105+:CONTINUEBATCH
106+
107 ECHO Python found, executing the tests...
108 COPY windows\clientdefs.py ubuntuone\clientdefs.py
109 COPY windows\logging.conf data\logging.conf
110 :: execute the tests with a number of ignored linux only modules
111-"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=twisted -c -p tests\platform\linux %* tests
112+"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=twisted -c -p tests\platform\linux %PARAMS% tests
113+
114+IF %SKIPLINT% == 1 (
115+ ECHO Skipping style checks
116+ GOTO :CLEAN)
117 "%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint"
118 :: test for style if we can, if pep8 is not present, move to the end
119-IF EXIST "%PYTHONEXEPATH%\Scripts\pep8.exe"
120-"%PYTHONEXEPATH%\Scripts\pep8.exe" --repeat ubuntuone
121-ELSE
122-ECHO Style checks were not done
123+IF EXIST "%PYTHONEXEPATH%\Scripts\pep8.exe" (
124+ "%PYTHONEXEPATH%\Scripts\pep8.exe" --repeat ubuntuone
125+)ELSE (
126+ ECHO Style checks were not done)
127+:CLEAN
128 :: Delete the temp folders
129 RMDIR /s /q _trial_temp
130 RMDIR /s /q .coverage

Subscribers

People subscribed via source and target branches