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} {
eebfe1f40f 2020-03-25 rkeene: for {set i 0} {$i < 100000} {incr i} {
eebfe1f40f 2020-03-25 rkeene: set filename [expr rand()]
eebfe1f40f 2020-03-25 rkeene: ::xvfs::processFile $fsName "" $filename [dict create type file fileContents [expr rand()]]
eebfe1f40f 2020-03-25 rkeene: lappend retval $filename
eebfe1f40f 2020-03-25 rkeene: }
eebfe1f40f 2020-03-25 rkeene:
eebfe1f40f 2020-03-25 rkeene: dict set ::myOwnVFS "" children [list foo xvfs-create-synthetic {*}$retval]
eebfe1f40f 2020-03-25 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: }
eebfe1f40f 2020-03-25 rkeene: lappend retval {*}[dict keys $::myOwnVFS]
eebfe1f40f 2020-03-25 rkeene:
eebfe1f40f 2020-03-25 rkeene: return $retval
c8742de968 2019-09-20 rkeene: }
c8742de968 2019-09-20 rkeene:
c8742de968 2019-09-20 rkeene: ::xvfs::run --directory [pwd] --name synthetic