chiark / gitweb /
use utf-8 as default encoding for config.py
[fdroidserver.git] / tests / run-tests
index c770091f2339583932a3702d550c5727fa250d34..dfdda5ad01ff39f935c079d40a46a427cd9358bc 100755 (executable)
@@ -33,7 +33,7 @@ create_fake_android_home() {
 
 create_test_dir() {
     test -e $WORKSPACE/.testfiles || mkdir $WORKSPACE/.testfiles
-    TMPDIR=$WORKSPACE/.testfiles  mktemp -d
+    mktemp -d $WORKSPACE/.testfiles/run-tests.XXXX
 }
 
 create_test_file() {
@@ -115,7 +115,26 @@ $fdroid --version
 echo_header "build the TeX manual"
 
 cd $WORKSPACE/docs
-./gendocs.sh -o html --email admin@f-droid.org fdroid "F-Droid Server Manual"
+# this is only ever generated officially on GNU/Linux
+if [ `uname -s` == "Linux" ]; then
+    ./gendocs.sh -o html --email admin@f-droid.org fdroid "F-Droid Server Manual"
+fi
+
+
+#------------------------------------------------------------------------------#
+echo_header "test UTF-8 metadata"
+
+REPOROOT=`create_test_dir`
+cd $REPOROOT
+
+$fdroid init
+sed -i.tmp 's,^ *repo_description.*,repo_description = """获取已安装在您的设备上的应用的,' config.py
+mkdir metadata
+cp $WORKSPACE/tests/urzip.apk repo/
+cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.txt metadata/
+
+$fdroid readmeta
+$fdroid update
 
 
 #------------------------------------------------------------------------------#
@@ -156,6 +175,41 @@ fi
 set -e
 
 
+#------------------------------------------------------------------------------#
+echo_header "ensure commands that don't need the JDK work without a JDK configed"
+
+REPOROOT=`create_test_dir`
+cd $REPOROOT
+mkdir repo
+mkdir metadata
+echo "License:GPL" >> metadata/fake.txt
+echo "Summary:Yup still fake" >> metadata/fake.txt
+echo "Categories:Internet" >> metadata/fake.txt
+echo "Description:" >> metadata/fake.txt
+echo "this is fake" >> metadata/fake.txt
+echo "." >> metadata/fake.txt
+
+# fake that no JDKs are available
+echo 'java_paths = {}' > config.py
+
+LOCAL_COPY_DIR=`create_test_dir`/fdroid
+mkdir -p $LOCAL_COPY_DIR/repo
+echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
+
+$fdroid checkupdates
+$fdroid gpgsign
+$fdroid lint
+$fdroid readmeta
+$fdroid rewritemeta fake
+$fdroid server update
+$fdroid scanner
+
+# run these to get their output, but the are not setup, so don't fail
+$fdroid build || true
+$fdroid import || true
+$fdroid install || true
+
+
 #------------------------------------------------------------------------------#
 echo_header "create a source tarball and use that to build a repo"
 
@@ -468,7 +522,7 @@ test -e repo/index.jar
 grep -F '<application id=' repo/index.xml > /dev/null
 
 # now set fake repo_keyalias
-sed -i 's,^ *repo_keyalias.*,repo_keyalias = "fake",' $REPOROOT/config.py
+sed -i.tmp 's,^ *repo_keyalias.*,repo_keyalias = "fake",' $REPOROOT/config.py
 set +e
 $fdroid update
 if [ $? -eq 0 ]; then