Opened 10 years ago

Closed 8 years ago

#44749 closed defect (fixed)

reclaim test suite fails if not run with superuser privileges

Reported by: larryv (Lawrence Velázquez) Owned by: ksammons@…
Priority: Normal Milestone:
Component: base Version: 2.3.99
Keywords: gsoc14-cleanup Cc:
Port:

Description

Running the macports1.0 test suite without superuser privileges fails because the remove_distfiles test tries to write to the distfiles directory used by the current MacPorts installation.

% make -C ~/Projects/MacPorts/git-svn/trunk/base/src/macports1.0 test
/opt/local/libexec/macports/bin/tclsh8.5 ./tests/test.tcl -nocolor
Warning: test
Total:41 Passed:34 Failed:00 Skipped:07  macports.test
    Constraint: 7	root
Total:14 Passed:14 Failed:00 Skipped:00  macports_dlist.test
Total:08 Passed:08 Failed:00 Skipped:00  macports_util.test
Total:04 Passed:01 Failed:01 Skipped:02  reclaim.test
    Constraint: 2	root


==== remove_distfiles # Regression test for remove_distfiles.
    # 
    # Constraints:
    #               None.

    Test for distfiles being successfully removed. FAILED
==== Contents of test case:

    
    set path [file join ${macports::portdbpath} distfiles]
    set file [file join $path "test.txt"]

    set fd   [open $file w]
    close $fd
    
    reclaim::remove_distfiles

    if {[file exists $file]} {
        return "FAIL: Did not remove distfile."
    }

    return "Successfully removed distfile."


---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't open "/opt/local/var/macports/distfiles/test.txt": permission denied
    while executing
"open $file w"
    ("uplevel" body line 6)
    invoked from within
"uplevel 1 $script"
---- errorCode: POSIX EACCES {permission denied}
==== remove_distfiles FAILED


make: *** [test] Error 1
%

The test should not be doing this; it should create a dummy portdbpath and use it, like macports.test does.

Change History (2)

comment:1 Changed 10 years ago by larryv (Lawrence Velázquez)

Keywords: gsoc14-cleanup added

comment:2 Changed 8 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.