From 1a361b629a99075c2bec18411469a70bc3957c41 Mon Sep 17 00:00:00 2001 From: Pavel Platto Date: Wed, 16 Jul 2014 20:35:12 +0300 Subject: [PATCH] os_fchown: enable 'change group' unittest on Travis-CI Add section `before_install` in `.travis.yml` to create test group and add current user to this group. It is needed because by default user on Travis-CI belongs only to one primary group derived from that user. So we have no alternative to change group of the file. --- .travis.yml | 10 +++++++++- test/unit/os/fs_spec.moon | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4af91446ec..1965fb72b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,5 +13,13 @@ env: - CI_TARGET=clint - CI_TARGET=api-python - CI_TARGET=coverity +before_install: + # Adds user to a dummy group. + # That allows to test changing the group of the file by `os_fchown`. + - sudo groupadd chown_test + - sudo usermod -a -G chown_test ${USER} script: - - sh -e "${CI_SCRIPTS}/${CI_TARGET}.sh" + # This will pass the environment variables down to a bash process which runs + # as $USER, while retaining the environment variables defined and belonging + # to secondary groups given above in usermod. + - sudo -E su ${USER} -c "sh -e \"${CI_SCRIPTS}/${CI_TARGET}.sh\"" diff --git a/test/unit/os/fs_spec.moon b/test/unit/os/fs_spec.moon index e63674e2eb..dd787e76cd 100644 --- a/test/unit/os/fs_spec.moon +++ b/test/unit/os/fs_spec.moon @@ -188,7 +188,7 @@ describe 'fs function', -> new_gid = id_fd\read '*n' id_fd\close! - -- User can be a member of only one group (e.g., it is on Travis-CI). + -- User can be a member of only one group. -- In that case we can not perform this test. if new_gid eq 0, (os_fchown filename, -1, new_gid)