1

plistファイルをJUnitスタイルのXMLに変換しようとしています。plistをJUnit/ANTXMLに変換するxslスタイルシートがあります。

plistをXMLに変換するために実行するperlコードは次のとおりです。

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++;
}

Hudson / Jenkinsでperlスクリプトを実行すると、次のエラーメッセージが出力されます。

〜/ Hudson / build / worksheet / ui-automation / Automation \ test \ suite / Logs / Run \ 1 / Automation \ Results.plistを開けませんでした:そのようなファイルまたはディレクトリはありません

エラーの原因my $source = $parser->parse_file($path2plist);はコード内です。ファイルが見つからない/読み取れない理由がわかりません。

エラーの原因を知っている人はいますか?

4

1 に答える 1

3

エラーメッセージに記載されているパスには、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
于 2012-10-29T05:06:40.623 に答える