<commit_before>#!/bin/sh
#
# This file is part of the CernVM File System
# This script takes care of creating, removing, and maintaining repositories
# on a Stratum 0/1 server
#
# Tests for "cvmfs_server_util.sh"

. ./cvmfs_server_util.sh

print_check() {
    echo "Got: $1 Expected: $2"
}

### Testing check_overlayfs_version

check_overlayfs() {
    return 0
}

cvmfs_sys_uname() {
    echo $mock_kernel_version
}

# check_overlayfs_version will call cvmfs_sys_is_redhat
cvmfs_sys_is_redhat() {
    return $mock_is_redhat
}


mock_is_redhat=0 # true

mock_kernel_version="4.2.0"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 0

mock_kernel_version="4.2.0-100"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 0

mock_kernel_version="3.10.0-493"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 0

mock_kernel_version="3.10.0-999"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 0

mock_kernel_version="3.10.0-492"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 1

mock_kernel_version="3.10.0"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 1

mock_kernel_version="3.10.0-493"
mock_is_redhat=1 # False
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 1

mock_kernel_version="3.10.0-492"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 1<commit_msg>minor adjustment for consistent style<commit_after>#!/bin/sh
#
# This file is part of the CernVM File System
# This script takes care of creating, removing, and maintaining repositories
# on a Stratum 0/1 server
#
# Tests for "cvmfs_server_util.sh"

. ./cvmfs_server_util.sh

print_check() {
    echo "Got: $1 Expected: $2"
}

### Testing check_overlayfs_version

check_overlayfs() {
    return 0
}

cvmfs_sys_uname() {
    echo $mock_kernel_version
}

# check_overlayfs_version will call cvmfs_sys_is_redhat
cvmfs_sys_is_redhat() {
    return $mock_is_redhat
}


mock_is_redhat=0 # true

mock_kernel_version="4.2.0"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 0

mock_kernel_version="4.2.0-100"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 0

mock_kernel_version="3.10.0-493"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 0

mock_kernel_version="3.10.0-999"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 0

mock_kernel_version="3.10.0-492"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 1

mock_kernel_version="3.10.0"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 1

mock_is_redhat=1 # False

mock_kernel_version="3.10.0-493"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 1

mock_kernel_version="3.10.0-492"
printf "Kernel version: %s; RedHat: %s\n" $mock_kernel_version $mock_is_redhat
print_check $(check_overlayfs_version >/dev/null; echo $?) 1
{'fraction_non_alphanumeric': 0.12761664564943254, 'fraction_numerical': 0.0317780580075662, 'mean_word_length': 6.056939501779359, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6121415', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1527, 'n_words': 335}