c8742de968 2019-09-20 rkeene: #! /usr/bin/env tclsh
c8742de968 2019-09-20 rkeene:
c8742de968 2019-09-20 rkeene: set sourceDirectory [file dirname [file normalize [info script]]]
c8742de968 2019-09-20 rkeene: lappend auto_path [file join $sourceDirectory lib]
c8742de968 2019-09-20 rkeene: package require xvfs
c8742de968 2019-09-20 rkeene:
c8742de968 2019-09-20 rkeene: proc ::xvfs::callback::setOutputFileName {args} {
c8742de968 2019-09-20 rkeene: return "/"
c8742de968 2019-09-20 rkeene: }
c8742de968 2019-09-20 rkeene:
fc90ef3457 2019-09-20 rkeene: dict set ::myOwnVFS "" {
fc90ef3457 2019-09-20 rkeene: type directory
fc90ef3457 2019-09-20 rkeene: children {foo xvfs-create-synthetic}
fc90ef3457 2019-09-20 rkeene: }
fc90ef3457 2019-09-20 rkeene: dict set ::myOwnVFS "foo" {
fc90ef3457 2019-09-20 rkeene: type file
fc90ef3457 2019-09-20 rkeene: fileContents "abc"
fc90ef3457 2019-09-20 rkeene: }
fc90ef3457 2019-09-20 rkeene: dict set ::myOwnVFS "xvfs-create-synthetic" {
fc90ef3457 2019-09-20 rkeene: type file
fc90ef3457 2019-09-20 rkeene: }
fc90ef3457 2019-09-20 rkeene:
c8742de968 2019-09-20 rkeene: proc ::xvfs::callback::addOutputFiles {fsName} {
9f07de5ec5 2019-12-02 rkeene: for {set i 0} {$i < 100000} {incr i} {
9f07de5ec5 2019-12-02 rkeene: set filename [expr rand()]
9f07de5ec5 2019-12-02 rkeene: ::xvfs::processFile $fsName "" $filename [dict create type file fileContents [expr rand()]]
9f07de5ec5 2019-12-02 rkeene: lappend retval $filename
9f07de5ec5 2019-12-02 rkeene: }
9f07de5ec5 2019-12-02 rkeene:
9f07de5ec5 2019-12-02 rkeene: dict set ::myOwnVFS "" children [list foo xvfs-create-synthetic {*}$retval]
9f07de5ec5 2019-12-02 rkeene:
fc90ef3457 2019-09-20 rkeene: dict for {outputName fileContentsDict} $::myOwnVFS {
fc90ef3457 2019-09-20 rkeene: set inputFile $outputName
fc90ef3457 2019-09-20 rkeene: if {[dict exists $fileContentsDict inputFile]} {
fc90ef3457 2019-09-20 rkeene: set inputFile [dict get $fileContentsDict inputFile]
fc90ef3457 2019-09-20 rkeene: }
fc90ef3457 2019-09-20 rkeene: ::xvfs::processFile $fsName $inputFile $outputName $fileContentsDict
fc90ef3457 2019-09-20 rkeene: }
9f07de5ec5 2019-12-02 rkeene: lappend retval {*}[dict keys $::myOwnVFS]
9f07de5ec5 2019-12-02 rkeene:
9f07de5ec5 2019-12-02 rkeene: return $retval
c8742de968 2019-09-20 rkeene: }
c8742de968 2019-09-20 rkeene:
c8742de968 2019-09-20 rkeene: ::xvfs::run --directory [pwd] --name synthetic