Bug 197612 - usr.sbin.pw.pw_usernext:usernext* tests are broken (but pass sometimes...?)
Summary: usr.sbin.pw.pw_usernext:usernext* tests are broken (but pass sometimes...?)
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: tests (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-testing (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-14 06:52 UTC by Enji Cooper
Modified: 2015-02-16 21:55 UTC (History)
2 users (show)

See Also:


Attachments
gets rid of the misplaced closing curly bracket (412 bytes, patch)
2015-02-14 11:15 UTC, oneil.rs
no flags Details | Diff
The random limit was going out of bounds of the test. (583 bytes, patch)
2015-02-15 17:05 UTC, oneil.rs
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2015-02-14 06:52:36 UTC
- https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/683/testReport/junit/usr.sbin.pw/pw_usernext/usernext/
- https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/687/testReport/usr.sbin.pw/pw_usernext/usernext_assigned_group/

- :usernext_assigned_group has a dangling curly bracket, that appears to only fail part of the time.
- The tests have some questionable assumptions about available GIDs, that might fail if the default available GID wasn't 1001.
Comment 1 oneil.rs 2015-02-14 11:15:06 UTC
Created attachment 152966 [details]
gets rid of the misplaced closing curly bracket

The test creates a ghost environment where the base user id is 1001. So that aspect should be a non issue. This should resolve the errors that are occurring related to the  invalid curly bracket.
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-02-14 18:23:23 UTC
A commit references this bug:

Author: brd
Date: Sat Feb 14 18:22:32 UTC 2015
New revision: 278767
URL: https://svnweb.freebsd.org/changeset/base/278767

Log:
  Remove an extra curly bracket that was causing intermittent failures.

  PR:		197612
  Submitted by:	Robert O'Niel <oneil.rs@gmail.com>
  Approved by:	will

Changes:
  head/usr.sbin/pw/tests/pw_usernext.sh
Comment 3 Brad Davis freebsd_committer freebsd_triage 2015-02-14 18:27:48 UTC
Committed, thanks!
Comment 4 oneil.rs 2015-02-15 17:05:14 UTC
Created attachment 153007 [details]
The random limit was going out of bounds of the test.

The random limit is now in bounds and should not fail.
Comment 5 Enji Cooper freebsd_committer freebsd_triage 2015-02-15 19:04:06 UTC
(In reply to oneil.rs from comment #4)

Would this correspond to this failure (from https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/702/testReport/junit/usr.sbin.pw/pw_usernext/usernext/ )?

Fail: regexp 10010:10010 not in stdout
1010:1010
Comment 6 Enji Cooper freebsd_committer freebsd_triage 2015-02-15 19:04:39 UTC
Reopening because the testcases still fail sporadically
Comment 7 Brad Davis freebsd_committer freebsd_triage 2015-02-15 20:09:59 UTC
Thanks, I am running a loop of this test to see if the new fix I have takes care of it.
Comment 8 Enji Cooper freebsd_committer freebsd_triage 2015-02-15 20:45:36 UTC
(In reply to Brad Davis from comment #7)

It will. Why isn't arithmetic done properly with the base value though..? 

$ sudo /usr/libexec/atf-sh pw_usernext.sh usernext                                                                                                  
pw_usernext.sh: WARNING: Running test cases outside of kyua(1) is unsupported
pw_usernext.sh: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Executing command [ pw -V /root useradd test1 ]
Executing command [ pw -V /root useradd test2 ]
Executing command [ pw -V /root useradd test3 ]
Executing command [ pw -V /root useradd test4 ]
Executing command [ pw -V /root useradd test5 ]
Executing command [ pw -V /root usernext ]
passed
[ngie@fuji-current-amd64 /usr/src.svn/usr.sbin/pw/tests]$ sudo /usr/libexec/atf-sh pw_usernext.sh usernext_assigned_group
pw_usernext.sh: WARNING: Running test cases outside of kyua(1) is unsupported
pw_usernext.sh: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Executing command [ pw -V /root useradd -n test1 -g 0 ]
Executing command [ pw -V /root usernext ]
passed
$ svn diff pw_usernext.sh 
Index: pw_usernext.sh
===================================================================
--- pw_usernext.sh      (revision 278777)
+++ pw_usernext.sh      (working copy)
@@ -15,7 +15,7 @@
                atf_check -s exit:0 ${PW} useradd test$var0
                var0=`expr $var0 + 1`
        done
-       atf_check -s exit:0 -o match:"100${LIMIT}:100${LIMIT}" \
+       atf_check -s exit:0 -o match:"$(( 1000 + ${LIMIT} )):$(( 1000 + ${LIMIT} ))" \
                ${PW} usernext
 }
 
@@ -32,7 +32,7 @@
                atf_check -s exit:0 ${PW} useradd -n test$var0 -g 0
                var0=`expr $var0 + 1`
        done
-       atf_check -s exit:0 -o match:"100${LIMIT}:1001" \
+       atf_check -s exit:0 -o match:"$(( 1000 + ${LIMIT} )):1001" \
                ${PW} usernext
 }
Comment 9 commit-hook freebsd_committer freebsd_triage 2015-02-15 21:42:45 UTC
A commit references this bug:

Author: brd
Date: Sun Feb 15 21:42:11 UTC 2015
New revision: 278819
URL: https://svnweb.freebsd.org/changeset/base/278819

Log:
  Really fix the pw_usernext tests.

  PR:		197612
  Approved by:	will

Changes:
  head/usr.sbin/pw/tests/pw_usernext.sh
Comment 10 Brad Davis freebsd_committer freebsd_triage 2015-02-16 21:55:13 UTC
The tests are stable now.