xref: /trunk/test/odf-validate/fixtures/gen-run.sh (revision 0e16a31d78a652c56c5c0fc79c752f48b9048df9)
1#!/bin/zsh
2#**************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20# usage: fixtures/gen-run.sh <area> <strict|ext|v13|x13> <port> <outdir>
21# Starts a headless office saving in the given ODF mode (profile created as drive.sh does), runs fixtures/<area>/make.py <port> <outdir>, stops it.
22source ${0:A:h:h}/env.sh
23area=$1; mode=$2; port=$3; out=$4
24case $mode in ext) v=3;; strict) v=4;; v13) v=5;; x13) v=6;; *) echo "gen-run.sh: unknown mode $mode" >&2; exit 2;; esac
25[[ -f $D/fixtures/$area/make.py ]] || { echo "gen-run.sh: no fixtures/$area/make.py" >&2; exit 2; }
26prof=t12_${area}_$mode
27/bin/rm -rf $D/runs/profile_$prof
28mkdir -p $D/runs/profile_$prof/user
29cat > $D/runs/profile_$prof/user/registrymodifications.xcu <<XCU
30<?xml version="1.0" encoding="UTF-8"?>
31<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
32<item oor:path="/org.openoffice.Office.Common/Save/ODF"><prop oor:name="DefaultVersion" oor:op="fuse"><value>$v</value></prop></item>
33</oor:items>
34XCU
35$D/start.sh $prof $port || exit 2
36$D/runpy.sh $D/fixtures/$area/make.py $port $out
37rc=$?
38pkill -f "[p]rofile_$prof"
39exit $rc
40