-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wip] travis: run unit tests on MacOS
Signed-off-by: Aleksa Sarai <asarai@suse.de>
- Loading branch information
Showing
16 changed files
with
186 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
# readlinkf: POSIX-compliant implementation of readlink -f. | ||
# Author: Koichi Nakashima <koichi@nksm.name> | ||
# Licensed under the Creative Commons Zero v1.0 Universal license. | ||
# <https://creativecommons.org/publicdomain/zero/1.0/> | ||
|
||
# Copied verbatim from v1.1.0 of <https://github.com/ko1nksm/readlinkf>. | ||
|
||
# POSIX compliant version | ||
readlinkf_posix() { | ||
[ "${1:-}" ] || return 1 | ||
max_symlinks=40 | ||
CDPATH='' # to avoid changing to an unexpected directory | ||
|
||
target=$1 | ||
[ -e "${target%/}" ] || target=${1%"${1##*[!/]}"} # trim trailing slashes | ||
[ -d "${target:-/}" ] && target="$target/" | ||
|
||
cd -P . 2>/dev/null || return 1 | ||
while [ "$max_symlinks" -ge 0 ] && max_symlinks=$((max_symlinks - 1)); do | ||
if [ ! "$target" = "${target%/*}" ]; then | ||
case $target in | ||
/*) cd -P "${target%/*}/" 2>/dev/null || break ;; | ||
*) cd -P "./${target%/*}" 2>/dev/null || break ;; | ||
esac | ||
target=${target##*/} | ||
fi | ||
|
||
if [ ! -L "$target" ]; then | ||
target="${PWD%/}${target:+/}${target}" | ||
printf '%s\n' "${target:-/}" | ||
return 0 | ||
fi | ||
|
||
# `ls -dl` format: "%s %u %s %s %u %s %s -> %s\n", | ||
# <file mode>, <number of links>, <owner name>, <group name>, | ||
# <size>, <date and time>, <pathname of link>, <contents of link> | ||
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html | ||
link=$(ls -dl -- "$target" 2>/dev/null) || break | ||
target=${link#*" $target -> "} | ||
done | ||
return 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* umoci: Umoci Modifies Open Containers' Images | ||
* Copyright (C) 2016-2020 SUSE LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package testutils | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// Unix returns the local Time corresponding to the given Unix time, rounded to | ||
// the timestamp granularity for this system. | ||
func Unix(sec, nsec int64) time.Time { | ||
return time.Unix(sec, nsec).Round(FtimeGranularity()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* umoci: Umoci Modifies Open Containers' Images | ||
* Copyright (C) 2016-2020 SUSE LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package testutils | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// FtimeGranularity is the filesystem timestamp granularity for this system. | ||
func FtimeGranularity() time.Duration { | ||
// On OS X, filesystem timestamps have second-level granularity. | ||
// Nanosecond values are silently truncated if you try to set them. | ||
return time.Second | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// +build !darwin | ||
|
||
/* | ||
* umoci: Umoci Modifies Open Containers' Images | ||
* Copyright (C) 2016-2020 SUSE LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package testutils | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// FtimeGranularity is the filesystem timestamp granularity for this system. | ||
// TODO: We should probably make this dependent on the path since some | ||
// filesystems can have different granularities... | ||
func FtimeGranularity() time.Duration { | ||
// On Linux, most filesystems have nano-second-level granularity. | ||
return time.Nanosecond | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.