1*87aa9c9eSJonas Devlieghere# Test that LLDB correctly allows scripted commands to set immediate output to 2*87aa9c9eSJonas Devlieghere# a file. 3*87aa9c9eSJonas Devlieghere 4*87aa9c9eSJonas Devlieghere# RUN: echo "READ" > %t.read.txt 5*87aa9c9eSJonas Devlieghere# RUN: echo "WRITE" > %t.write.txt 6*87aa9c9eSJonas Devlieghere# RUN: echo "APPEND" > %t.append.txt 7*87aa9c9eSJonas Devlieghere# RUN: echo "READ PLUS" > %t.read_plus.txt 8*87aa9c9eSJonas Devlieghere# RUN: echo "WRITE PLUS" > %t.write_plus.txt 9*87aa9c9eSJonas Devlieghere# RUN: echo "APPEND PLUS" > %t.append_plus.txt 10*87aa9c9eSJonas Devlieghere 11*87aa9c9eSJonas Devlieghere# RUN: %lldb -s %s \ 12*87aa9c9eSJonas Devlieghere# RUN: -o 'command script import %S/Inputs/custom_command.py' \ 13*87aa9c9eSJonas Devlieghere# RUN: -o 'command script add -f custom_command.write_file mywrite' \ 14*87aa9c9eSJonas Devlieghere# RUN: -o 'mywrite %t.read.txt r' \ 15*87aa9c9eSJonas Devlieghere# RUN: -o 'mywrite %t.write.txt w' \ 16*87aa9c9eSJonas Devlieghere# RUN: -o 'mywrite %t.append.txt a' \ 17*87aa9c9eSJonas Devlieghere# RUN: -o 'mywrite %t.write_plus.txt w+' \ 18*87aa9c9eSJonas Devlieghere# RUN: -o 'mywrite %t.read_plus.txt r+' \ 19*87aa9c9eSJonas Devlieghere# RUN: -o 'mywrite %t.append_plus.txt a+' \ 20*87aa9c9eSJonas Devlieghere# RUN: -o 'command script delete mywrite' 21*87aa9c9eSJonas Devlieghere 22*87aa9c9eSJonas Devlieghere# RUN: cat %t.read.txt | FileCheck %s --check-prefix READ 23*87aa9c9eSJonas Devlieghere# READ: READ 24*87aa9c9eSJonas Devlieghere# READ-NOT: writing to file with mode 25*87aa9c9eSJonas Devlieghere 26*87aa9c9eSJonas Devlieghere# RUN: cat %t.write.txt | FileCheck %s --check-prefix WRITE 27*87aa9c9eSJonas Devlieghere# WRITE-NOT: WRITE 28*87aa9c9eSJonas Devlieghere# WRITE: writing to file with mode: w 29*87aa9c9eSJonas Devlieghere 30*87aa9c9eSJonas Devlieghere# RUN: cat %t.append.txt | FileCheck %s --check-prefix APPEND 31*87aa9c9eSJonas Devlieghere# APPEND: APPEND 32*87aa9c9eSJonas Devlieghere# APPEND-NEXT: writing to file with mode: a 33*87aa9c9eSJonas Devlieghere 34*87aa9c9eSJonas Devlieghere# RUN: cat %t.write_plus.txt | FileCheck %s --check-prefix WRITEPLUS 35*87aa9c9eSJonas Devlieghere# WRITEPLUS-NOT: WRITE PLUS 36*87aa9c9eSJonas Devlieghere# WRITEPLUS: writing to file with mode: w+ 37*87aa9c9eSJonas Devlieghere 38*87aa9c9eSJonas Devlieghere# RUN: cat %t.read_plus.txt | FileCheck %s --check-prefix READPLUS 39*87aa9c9eSJonas Devlieghere# READPLUS-NOT: READ PLUS 40*87aa9c9eSJonas Devlieghere# READPLUS: writing to file with mode: r+ 41*87aa9c9eSJonas Devlieghere 42*87aa9c9eSJonas Devlieghere# RUN: cat %t.append_plus.txt | FileCheck %s --check-prefix APPENDPLUS 43*87aa9c9eSJonas Devlieghere# APPENDPLUS: APPEND PLUS 44*87aa9c9eSJonas Devlieghere# APPENDPLUS-NEXT: writing to file with mode: a+ 45*87aa9c9eSJonas Devlieghere 46*87aa9c9eSJonas Devlieghere# RUN: rm %t.read.txt 47*87aa9c9eSJonas Devlieghere# RUN: rm %t.write.txt 48*87aa9c9eSJonas Devlieghere# RUN: rm %t.append.txt 49*87aa9c9eSJonas Devlieghere# RUN: rm %t.write_plus.txt 50*87aa9c9eSJonas Devlieghere# RUN: rm %t.read_plus.txt 51*87aa9c9eSJonas Devlieghere# RUN: rm %t.append_plus.txt 52