chiark / gitweb /
FDroidPopen must have a locale to support UTF-8 filenames
[fdroidserver.git] / tests / run-tests
index 7629f431bb107db1f5dd070ec4f7225c6d6f77ad..c55319da8ada9f97841b0735585b4561b58b17f9 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() {
@@ -83,7 +83,7 @@ fi
 
 # allow the location of python to be overridden
 if [ -z $python ]; then
-    python=python2
+    python=python3
 fi
 
 set -x # show each command as it is executed
@@ -115,7 +115,41 @@ $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
+echo "mirrors = {'https://foo.bar/fdroid', 'http://secret.onion/fdroid'}" >> config.py
+mkdir metadata
+cp $WORKSPACE/tests/urzip.apk repo/
+cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.txt metadata/
+
+$fdroid readmeta
+$fdroid update
+
+
+#------------------------------------------------------------------------------#
+echo_header "copy tests/repo, generate a keystore, and update"
+
+REPOROOT=`create_test_dir`
+cd $REPOROOT
+$fdroid init
+cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/
+echo "accepted_formats = ['json', 'txt', 'xml', 'yml']" >> config.py
+$fdroid update --verbose
+test -e repo/index.xml
+test -e repo/index.jar
+grep -F '<application id=' repo/index.xml > /dev/null
 
 
 #------------------------------------------------------------------------------#
@@ -143,7 +177,7 @@ cp $WORKSPACE/tests/metadata/org.smssecure.smssecure.txt $REPOROOT/metadata/
 $fdroid readmeta
 
 # now make a fake duplicate
-touch $REPOROOT/metadata/org.smssecure.smssecure.yaml
+touch $REPOROOT/metadata/org.smssecure.smssecure.yml
 
 set +e
 $fdroid readmeta
@@ -503,7 +537,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