Skip to content
Snippets Groups Projects
Select Git revision
  • fsd_dev
  • master default protected
  • debug_AT
  • standard_fsd_with_ncal
  • standard_fsd
  • debug_fsd
  • debug_RP
  • radim
  • track_l
  • fsd_mr_atc
  • fsd_preproduction
  • geant_unique_id
  • fsd_mr_sim
  • tra_initCbmStack
  • my_master
  • hadronana
  • mcbm_master
  • nightly_master
  • APR21
  • dev_2021_25
  • dev_2021_24
  • dev_2021_23
  • dev_2021_22
  • dev_2021_21
  • dev_2021_20
  • dev_2021_19
  • RC3_APR21
  • dev_2021_18
  • RC2_APR21
  • dev_2021_17
  • RC1_APR21
  • dev_2021_16
  • dev_2021_15
  • dev_2021_14
  • dev_2021_13
  • dev_2021_12
  • dev_2021_11
  • dev_2021_10
38 results

CTestCustom.cmake

Blame
  • Forked from Computing / cbmroot
    Source project has a limited visibility.
    check-file-ending.sh 1.49 KiB
    #!/bin/bash
    # Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
    # SPDX-License-Identifier: GPL-3.0-only
    # First commited by Florian Uhlig
    
    
    if [[ $# -eq 1 ]]; then
      UPSTREAM=$1
    else
      if [ -z $UPSTREAM ]; then
        UPSTREAM=$(git remote -v | grep git.cbm.gsi.de[:/]computing/cbmroot | cut -f1 | uniq)
        if [ -z $UPSTREAM ]; then
          echo "Error: Name of upstream repository not provided and not found by automatic means"
          echo 'Please provide if by checking your remotes with "git remote -v" and exporting UPSTREAM'
          echo "or passing as an argument"
          exit -1
        fi
      fi
    fi  
    echo "Upstream name is :" $UPSTREAM
    
    
    # If one wants to find all files in the CbmRoot and not only the changed ones
    # uncomment the follwing line and comment the next two
    #CHANGED_FILES=$(find . -type f -not \( -path "./.git/*" -o -path "./geometry/*" -o -path "./input/*" -o -path "./external/*" -o -path "./parameters/*" -prune \))
    
    BASE_COMMIT=$UPSTREAM/master
    CHANGED_FILES=$(git diff --name-only $BASE_COMMIT)
    
    echo ""
    for file in $CHANGED_FILES; do
    
      # First check for text files and only do the further test on line endings
      # for text files
      result=$(file $file | grep -v text)
      if [[ -z $result ]]; then
        if [[ $(tail -c 1 $file) ]]; then
          echo "File $file does not finish with end of line"
          okay=false
        fi
      fi    
    done
    
    if [[ "$okay" = "false" ]]; then
      echo ""
      echo "Not all files have the correct file ending"
      echo "Test failed"
      echo ""
      exit 1
    else
      exit 0
    fi