2012-10-29 2 views
1

plist 파일을 JUnit 스타일 XML로 변환하려고합니다. plist를 JUnit/ANT XML로 변환하는 xsl 스타일 시트가 있습니다. 여기 파일 perl을 열 수 없습니다.

내가 XML로 PLIST를 변환 실행 펄 코드 :

모를 수가 : 허드슨/젠킨스에 펄 스크립트를 실행 한 후

my $parser = XML::LibXML->new(); 
my $xslt = XML::LibXSLT->new(); 
my $stylesheet = $xslt->parse_stylesheet_file("\\\~/Hudson/build/workspace/ui-automation/automation\\\ test\\\ suite/plist2junit.xsl"); 

my $counter = 1; 
my @plistFiles = glob('Logs/*/*.plist'); 
foreach (@plistFiles){ 
    #Escape the file path and specify abosulte path 
    my $plistFile = $_; 
    $plistFile =~ s/([()])/\\$1/g; 
    $path2plist = "\\\~/Hudson/build/workspace/ui-automation/automation\\\ test\\\ suite/$plistFile"; 
    #transform the plist file to xml 
    my $source = $parser->parse_file($path2plist); 
    my $results = $stylesheet->transform($source); 

    my $resultsFile = "\\\~/Hudson/build/workspace/ui-automation/automation\\\ test\\\ suite/JUnit/results$counter.xml"; 
    #create the output file 
    unless(open FILE, '>'.$resultsFile) { 
    # Die with error message 
    die "\nUnable to create $file\n"; 
    } 

    # Write results to the file. 
    $stylesheet->output_file($results, FILE); 
    close FILE; 
    $counter++; 
} 

,이 오류 메시지를 출력 t 개방 ~/허드슨/빌드/작업 공간// 자동화 UI 자동화 \ 테스트 \ 스위트/로그/실행 \ 1/자동화 \ Results.plist : 그런 파일이나 디렉토리

코드에서 my $source = $parser->parse_file($path2plist); 오류가 발생했습니다. 파일을 찾거나 읽을 수없는 이유를 알 수 없습니다.

누구든지 무슨 이유로 오류가 발생했는지 알고 계십니까?

+0

정말요? '~/Hudson/build/workspace/ui-automation/automation \ test \ suite/Logs/Run \ 1/Automation \ Results.plist와 같은 파일 이름으로 :'왜 파일을 찾을 수 없는지 알 수 없습니다 ? – friedo

+0

@friedo 무엇? 그것은 파일 경로 걸릴 수 없다 ??? – stackErr

+0

@friedo 귀하의 의견에 어떤 의미가 있는지 잘 모르겠습니다. 설명해 주시겠습니까? – stackErr

답변

3

오류 메시지에서 언급 한 경로에 세 가지 명백한 오류가 있습니다.

~/Hudson/build/workspace/ui-automation/automation\ test\ suite/Logs/Run\ 1/Automation\ Results.plist 

사람들은 다음과 같습니다 : 현재 디렉토리에 ~라는 이름의 디렉토리가

  1. 없습니다. 아마도 $ENV{HOME}의 값을 사용 하셨겠습니까?
  2. 디스크에 automation\ test\ suite이라는 디렉토리가 없지만 automation test suite이라는 디렉토리가있을 수 있습니다.
  3. 마찬가지로 디스크에는 Run\ 1이라는 디렉토리가 없지만 Run 1이라는 디렉토리가있을 수 있습니다.
+0

와우 그래, 지금 어리 석다! – stackErr

+0

이스케이프는 다른 것을 삽입 할 때 사용됩니다. 이스케이프에는 두 가지 레벨이 있지만 단 하나의 퍼가기 레벨 (Perl 소스 코드의 문자열)이 있습니다. – ikegami