From 70a11b3d79c29bdb31ae057e787aaf3d073efb8f Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 25 Jun 2021 12:39:47 +0200 Subject: [PATCH] Ignore ~/.gitconfig in tests and drop version test git version 2.3 was released in 2015. --- tests/run-tests | 274 +++++++++++++++++++++++------------------------- 1 file changed, 132 insertions(+), 142 deletions(-) diff --git a/tests/run-tests b/tests/run-tests index a6178a23..154b770e 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -65,11 +65,6 @@ fdroid_init_with_prebuilt_keystore() { echo 'keypass: r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=' >> config.yml } -# the < is reverse since 0 means success in exit codes -have_git_2_3() { - python3 -c "import sys; from distutils.version import LooseVersion as V; sys.exit(V(sys.argv[3]) < V('2.3'))" `git --version` -} - is_MD5_disabled() { javac $WORKSPACE/tests/IsMD5Disabled.java && java -cp $WORKSPACE/tests IsMD5Disabled } @@ -141,6 +136,11 @@ else sed=sed fi +# allow the location of git to be overridden +if [ -z "$git" ]; then + git="env HOME= GIT_AUTHOR_NAME='Test' GIT_AUTHOR_EMAIL='no@mail' GIT_COMMITTER_NAME='Test' GIT_COMMITTER_EMAIL='no@mail' git" +fi + set -x # show each command as it is executed #------------------------------------------------------------------------------# @@ -1047,19 +1047,15 @@ fdroid_init_with_prebuilt_keystore cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/ echo "binary_transparency_remote: $GIT_REMOTE" >> config.yml $fdroid update --verbose -if have_git_2_3; then - $fdroid deploy --verbose - test -e repo/index.xml - test -e repo/index.jar - test -e repo/index-v1.jar - grep -F '> config.yml - cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $OFFLINE_ROOT/ - mkdir $OFFLINE_ROOT/unsigned - cp $WORKSPACE/tests/urzip-release-unsigned.apk $OFFLINE_ROOT/unsigned +cd $OFFLINE_ROOT +fdroid_init_with_prebuilt_keystore +printf '\narchive_older: 3\n' >> config.yml +cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $OFFLINE_ROOT/ +mkdir $OFFLINE_ROOT/unsigned +cp $WORKSPACE/tests/urzip-release-unsigned.apk $OFFLINE_ROOT/unsigned - echo "mirrors: ['http://foo.bar/fdroid', 'http://asdflkdsfjafdsdfhkjh.onion/fdroid']" >> config.yml - echo "servergitmirrors: $SERVER_GIT_MIRROR" >> config.yml - echo "local_copy_dir: $LOCAL_COPY_DIR" >> config.yml - $fdroid update --pretty - grep -F '' repo/index.xml - grep -F '/fdroid/archive' archive/index.xml - test `grep '' repo/index.xml | wc -l` -eq 2 - test `grep '' archive/index.xml | wc -l` -eq 2 - cd binary_transparency - [ `git rev-list --count HEAD` == "1" ] - cd .. - $fdroid deploy --verbose - test -e $LOCAL_COPY_DIR/unsigned/urzip-release-unsigned.apk - grep -F '> config.yml +echo "servergitmirrors: $SERVER_GIT_MIRROR" >> config.yml +echo "local_copy_dir: $LOCAL_COPY_DIR" >> config.yml +$fdroid update --pretty +grep -F '' repo/index.xml +grep -F '/fdroid/archive' archive/index.xml +test `grep '' repo/index.xml | wc -l` -eq 2 +test `grep '' archive/index.xml | wc -l` -eq 2 +cd binary_transparency +[ "$($git rev-list --count HEAD)" == "1" ] +cd .. +$fdroid deploy --verbose +test -e $LOCAL_COPY_DIR/unsigned/urzip-release-unsigned.apk +grep -F '> metadata/fake.yml - echo "CurrentVersion: 1" >> metadata/fake.yml - echo "CurrentVersionCode: 1" >> metadata/fake.yml +cd .. +mkdir repo +mkdir metadata +echo "RepoType: git" >> metadata/fake.yml +echo "Repo: file://$(pwd)/bar" >> metadata/fake.yml +echo "AutoUpdateMode: Version" >> metadata/fake.yml +echo "UpdateCheckMode: Tags" >> metadata/fake.yml +echo "UpdateCheckData: '|||'" >> metadata/fake.yml +echo "CurrentVersion: 1" >> metadata/fake.yml +echo "CurrentVersionCode: 1" >> metadata/fake.yml - $fdroid checkupdates --allow-dirty - grep "CurrentVersionCode: 2" metadata/fake.yml -fi +$fdroid checkupdates --allow-dirty +grep "CurrentVersionCode: 2" metadata/fake.yml #------------------------------------------------------------------------------# echo_header "checkupdates ignore broken submodule" -if have_git_2_3; then - ROOT=$(create_test_dir) - cd "$ROOT" - mkdir foo bar - cd foo - git init - echo a > a - git add a - GIT_COMMITTER_NAME="Test" GIT_COMMITTER_EMAIL="no@mail" git commit -m a --author "Author " +ROOT=$(create_test_dir) +cd "$ROOT" +mkdir foo bar +cd foo +$git init +echo a > a +$git add a +$git commit -m a - cd ../bar - git init - git submodule add "file://$(pwd)/../foo" baz - GIT_COMMITTER_NAME="Test" GIT_COMMITTER_EMAIL="no@mail" git commit -am a --author "Author " - git tag 2 +cd ../bar +$git init +$git submodule add "file://$(pwd)/../foo" baz +$git commit -am a +$git tag 2 - cd ../foo - # delete the commit referenced in bar - GIT_COMMITTER_NAME="Test" GIT_COMMITTER_EMAIL="no@mail" git commit --amend -m aa --author "Author " - git reflog expire --expire=now --all - git gc --aggressive --prune=now +cd ../foo +# delete the commit referenced in bar +$git commit --amend -m aa +$git reflog expire --expire=now --all +$git gc --aggressive --prune=now - cd .. - mkdir repo - mkdir metadata - echo "RepoType: git" >> metadata/fake.yml - echo "Repo: file://$(pwd)/bar" >> metadata/fake.yml - echo "Builds:" >> metadata/fake.yml - echo " - versionName: 1" >> metadata/fake.yml - echo " versionCode: 1" >> metadata/fake.yml - echo " submodules: true" >> metadata/fake.yml - echo "AutoUpdateMode: Version" >> metadata/fake.yml - echo "UpdateCheckMode: Tags" >> metadata/fake.yml - echo "UpdateCheckData: '|||'" >> metadata/fake.yml - echo "CurrentVersion: 1" >> metadata/fake.yml - echo "CurrentVersionCode: 1" >> metadata/fake.yml +cd .. +mkdir repo +mkdir metadata +echo "RepoType: git" >> metadata/fake.yml +echo "Repo: file://$(pwd)/bar" >> metadata/fake.yml +echo "Builds:" >> metadata/fake.yml +echo " - versionName: 1" >> metadata/fake.yml +echo " versionCode: 1" >> metadata/fake.yml +echo " submodules: true" >> metadata/fake.yml +echo "AutoUpdateMode: Version" >> metadata/fake.yml +echo "UpdateCheckMode: Tags" >> metadata/fake.yml +echo "UpdateCheckData: '|||'" >> metadata/fake.yml +echo "CurrentVersion: 1" >> metadata/fake.yml +echo "CurrentVersionCode: 1" >> metadata/fake.yml - $fdroid checkupdates --allow-dirty - grep "CurrentVersionCode: 2" metadata/fake.yml -fi +$fdroid checkupdates --allow-dirty +grep "CurrentVersionCode: 2" metadata/fake.yml #------------------------------------------------------------------------------#